OnResolve Don't Send Message for Special Condition

We are using RT 3.8
We have a custom status “autoclose” (as part of “ActiveStatus”)

We have a script to close these ‘autoclose’ tickets after 14 days.
Script from RT3 Scripts - School of Computing - University of Kent

Currently, when the ticket goes from ‘autoclose’ to ‘resolved’ our
standard “Resolved” email goes out. For how we use it, the “Resolved”
email ends up being a duplicate.

I would like to adjust my “OnResolve” scrip to fire off like it is
EXCEPT when the status goes from autoclose TO resolved. I assume a
Custom Condition can be done here, but not sure how to go about it.

My Current “OnResolve” scrip is only for this one Queue, so it will not
mess with other queue settings.
Scrip Settings:

Description: OnResolveSendEmail
Condition: On Resolve
Action: Notify Requestors
Template: Resolved
Stage: TransactionCreate

Custom Condition, Action prep code and Cleanup are all blank.

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

We are using RT 3.8
We have a custom status “autoclose” (as part of “ActiveStatus”)

We have a script to close these ‘autoclose’ tickets after 14 days.
Script from RT3 Scripts - School of Computing - University of Kent

Currently, when the ticket goes from ‘autoclose’ to ‘resolved’ our
standard “Resolved” email goes out. For how we use it, the “Resolved”
email ends up being a duplicate.

I would like to adjust my “OnResolve” scrip to fire off like it is
EXCEPT when the status goes from autoclose TO resolved. I assume a
Custom Condition can be done here, but not sure how to go about it.

My Current “OnResolve” scrip is only for this one Queue, so it will not
mess with other queue settings.
Scrip Settings:

Description: OnResolveSendEmail
Condition: On Resolve
Action: Notify Requestors
Template: Resolved
Stage: TransactionCreate

Custom Condition, Action prep code and Cleanup are all blank.

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.


http://www.wikiak.org

Best regards, Ruslan.

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

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