[rt-users] TransactionObj OldValue is not working for me

Gene LeDuc gleduc at mail.sdsu.edu
Tue Mar 24 11:56:57 EDT 2009


Apply a liberal dose of $RT::Logger and see what turns up.  I'd split your 
IF into 2 pieces and then stick a logger in the gap.  Something like

my $Trans = $self->TransactionObj;    ### because I'm a lazy typist
if ($Trans->Type eq "Status")
{
   ### logger call to print value of ->OldValue and ->NewValue
   $RT::Logger->debug("(" . $Trans->Id . ") oldvalue is " . 
$Trans->OldValueval ?. ", newvalue is " . $Trans->NewValue);
   if ($Trans->OldValue ne "autoclose" && $Trans->NewValue eq "resolved")
   {
    blah blah
   }
}


At 12:51 PM 3/23/2009, slamp slamp wrote:
>I have the following in my resolve scrip that I borrowed from the
>site. I added the $self->TransactionObj->OldValue ne "autoclose"
>portion but it does not seem to be working. Can anyone help? Basically
>I don't want to get this notification if the status old value was set
>to autoclose.
>
>Condition: User defined
>Action: Notify Ccs and Requestors
>Template: Global resolved
>
>Custom condition:
>
>my $result = undef;
>
>if ($self->TransactionObj->Type eq "Status" &&
>     $self->TransactionObj->OldValue ne "autoclose" &&
>     $self->TransactionObj->NewValue eq "resolved")
>{
>     my $trans_list = $self->TicketObj->Transactions;
>     my $trans;
>     my $num_resolved = 0;
>
>     while ($trans = $trans_list->Next)
>     {
>         $num_resolved++ if ($trans->Ticket == $self->TicketObj->Id) &&
>                            ($trans->Type eq "Status") &&
>                            ($trans->NewValue eq "resolved");
>     }
>     $result = ($num_resolved <= 1);
>}
>
>return($result);
>_______________________________________________
>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
>Community help: http://wiki.bestpractical.com
>Commercial support: sales at bestpractical.com
>
>
>Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>Buy a copy at http://rtbook.bestpractical.com


-- 
Gene LeDuc, GSEC
Security Analyst
San Diego State University 




More information about the rt-users mailing list