[rt-users] Custom scrip : $cf->id is empty

Kevin Falcone falcone at bestpractical.com
Mon Nov 8 13:11:32 EST 2010


On Fri, Nov 05, 2010 at 02:09:33PM +0100, Horst Kriegers wrote:
>    Hello,
> 
>    we have freshly migrated from 3.6.6 to 3.8.8 and the following custom scrip doesn't work.
> 
>    If I comment the line 12 "return 0 unless $cf->id;", I can see that the $cf->id and $cf->Name
>    are empty
> 
> 
> 
>    my $trans = $self->TransactionObj;
>    my $ticket = $self->TicketObj;
> 
>    $RT::Logger->debug('***************************************');
>    $RT::Logger->debug('>> trans->Type = ' . $trans->Type);
> 
>    if ($trans->Type eq 'CustomField') {
>      my $cf = new RT::CustomField($RT::SystemUser);
>      $cf->LoadByName(Queue => $ticket->QueueObj->id, Name => "Qualification securite");

You want to be capturing

my ($ok, $msg) = $cf->LoadByName

and warning out the $msg to see why it isn't loading

>      ###return 0 unless $cf->id;
> 
>      $RT::Logger->debug('>> cf->id = ' . $cf->id);
>      $RT::Logger->debug('>> cf->Name = ' . $cf->Name);
>      $RT::Logger->debug('>> trans->Field = ' . $trans->Field);
>      $RT::Logger->debug('>> trans->NewValue = ' . $trans->NewValue);
>      $RT::Logger->debug('>> trans->OldValue = ' . $trans->OldValue);
>      $RT::Logger->debug('');
> 
>      if ($trans->Field == $cf->id && $trans->NewValue eq "Oui") {
>        $RT::Logger->debug($cf->Name . ' Ã OUI.');
>        return 1;
>      } else {
>        $RT::Logger->debug($cf->Name . ' pas à OUI.');
>      }
>    }
>    $RT::Logger->debug('***************************************');
> 
>    return 0;
> 
> 
> 
>    Logger result :
>    ------------------
>    [Fri Nov  5 13:07:14 2010] [debug]: *************************************** ((eval 5328):5)
>    [Fri Nov  5 13:07:14 2010] [debug]: >> trans->Type = CustomField ((eval 5328):6)
>    [Fri Nov  5 13:07:14 2010] [debug]: >> cf->id =  ((eval 5328):14)
>    [Fri Nov  5 13:07:14 2010] [debug]: >> cf->Name =  ((eval 5328):15)
>    [Fri Nov  5 13:07:14 2010] [debug]: >> trans->Field = 4 ((eval 5328):16)
>    [Fri Nov  5 13:07:14 2010] [debug]: >> trans->NewValue = Non ((eval 5328):17)
>    [Fri Nov  5 13:07:14 2010] [debug]: >> trans->OldValue = Oui ((eval 5328):18)
>    [Fri Nov  5 13:07:14 2010] [debug]:  ((eval 5328):19)
>    [Fri Nov  5 13:07:14 2010] [debug]:  pas à OUI. ((eval 5328):25)
>    [Fri Nov  5 13:07:14 2010] [debug]: *************************************** ((eval 5328):28)
> 
> 
> 
>    Thanks in advance for your help.
>    Horst
> 
> 
>    PS
>    Sorry for my bad english...
> 
>    _______________________________________________________________________
> 
>    Le contenu de ce courriel est uniquement reserve `a la personne ou l'organisme `a qui il est
>    destine. Si vous n'etes pas le destinataire prevu, veuillez nous en informer au plus vite et
>    detruire le present courriel. Dans ce cas, il ne vous est pas permis de copier ce courriel, de
>    le distribuer ou de l'utiliser de quelque maniere que ce soit.
> 
>    _______________________________________________________________________
> 
>    The content of this e-mail is intended only and solely for the use of the named recipient or
>    organisation. If you are not the named recipient, please inform us immediately and delete the
>    present e-mail. In this case, you are nor allowed to copy, distribute or use this e-mail in
>    any way.
> 
>    _______________________________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20101108/035cd3c8/attachment.sig>


More information about the rt-users mailing list