[rt-users] OnResolve Don't Send Message for Special Condition

Kevin Squire gentgeen at wikiak.org
Fri Oct 21 11:50:26 EDT 2011


On Fri, 21 Oct 2011 00:54:34 +0400
Ruslan Zakirov <ruz at bestpractical.com> wrote:

> You need "user defined" condition and fill in custom condition block
> with code. Take a look at lib/RT/Condition/StatusChange.pm and
> WritingCustomConditions on the wiki.
> 

The Example CustomConditions (link from the WritingCustomConditions
page) got me started, thank you.

Based on what I saw there, and some of my other scrips, I put together
the following, and tried it on my Testing Queue... through some trial
and error I think I got it right.

But since my perl skills are pretty weak, I was hoping someone could
look this over and let me know if yes, my logic/scrip for the Custom
Condition is good.  (I want the Notify Requestors with template
Resolved to happen when status changes to resolve, UNLESS the change
is autoclose --> resolved  )


Description: CustomResolveMute
Condition: User Defined
Action: Notify Requestors
Template: Resolved
Stage: TransactionCreate

Custom Condition:

$RT::Logger->debug( "Running CustomOnResolveMute Scrip" );
## Check to see that the change is a status change
return 0 unless $self->TransactionObj->Type eq "Status";
$RT::Logger->debug( "CustomOnResolveMute - Status change True" );

## Check to see if the new status is 'resolved'
return 0 unless $self->TransactionObj->NewValue eq "resolved";
$RT::Logger->debug( "CustomOnResolveMute - Status changed to resolved" );

## Check to see is old status is 'autoclose'
return 0 if $self->TransactionObj->OldValue eq "autoclose";
$RT::Logger->debug( "CustomOnResolveMute - Previous status was not autoclose" );

## only reason I should get here is if 3 conditions are meet:
###    1) this is a status change
###    2) ticket is changed to 'resolved'
###    3) ticket was not changed from 'autoclose' to 'resolved'
return 1;

Action prep code: Blank
Cleanup: blank


-- 
http://www.wikiak.org

#############################################################
 Associate yourself with men of good quality if you esteem    
 your own reputation; for 'tis better to be alone then in bad 
 company.        - George Washington, Rules of Civility



More information about the rt-users mailing list