[rt-users] Custom Condition To Send Email on Resolve if No Article Sent as Part of Resolve

Foggi, Nicola NFOGGI at depaul.edu
Sat Aug 2 22:47:53 EDT 2014


Thanks Alex,

That code with some modification worked for me, I only want the scip to 
apply IF Status changed -> resolved AND NOT if RefersTo link is added (I 
can ignore the correspondence I think safely as the significant event is 
the addlink to the article (that it's set already to send out via a 
lifecycle setting)  I guess feasibly the user could change it to be a 
comment vs correspondence, so I'll have to think about that.  I modified 
your code to the follow for the list if anyone else needs it (just a 
slight change on the logic of the return codes.  I didn't kill the 
correspondence yet incase I end up using it.

Thanks for your help!

Nicola

[final code used for now]

my ($found_correspondence, $found_resolved, $found_refersto);
my @txns = @{ $self->TicketObj->TransactionBatch };
for my $txn (@txns) {

     # look for correspondence
     if ($txn->Type eq 'Correspond') {
         RT::Logger->debug('this operation involves correspondence');
         $found_correspondence++;
         next;
     }

     # look for status change to resolved
     if (
         (
             $txn->Type eq 'Status'
             or ($txn->Type eq 'Set' and $txn->Field eq 'Status')
         )
         and $txn->NewValue eq 'resolved'
     ) {
         RT::Logger->debug('this operation involves resolution');
         $found_resolved++;
         next;
     }

     # look for addition of RefersTo link
     if ($txn->Type eq 'AddLink' and $txn->Field eq 'RefersTo') {
         RT::Logger->debug('this operation involves adding a RefersTo 
link');
         $found_refersto++;
         next;
     }

}

if ($found_resolved) {

     return 1 if not ($found_correspondence && $found_refersto);
     return 0;

}

return 0;



More information about the rt-users mailing list