MuteResolve: Difference between revisions
m (3 revisions imported) |
mNo edit summary |
||
Line 1: | Line 1: | ||
Contributed by [ | Contributed by [[User:Cris70|Cris]] | ||
=== Overview === | === Overview === |
Revision as of 01:53, 20 June 2016
Contributed by Cris
Overview
By default RT has a scrip to notify requestors when a ticket is resolved. This is generally a good idea; however, sometimes you may want to avoid notifying requestors. One example is when someone reopens a ticket just because he answered "Thanks" to your resolution notification.
I haven't found a solution satisfying me, so I developed my own. It involves a transaction custom field, called MuteResolve, that privileged users can set when they resolve a ticket. If set to "Yes", RT won't send any email.
Note that, being a transaction custom field, you'll see it in any transaction, not only on resolve (e.g. you'll see it on the ticket "comment" page too), but it only makes sense on resolve.
This is implemented on RT 3.8.4.
2010-08-23 Updated for 3.8.8 (change in validation).
How to set up MuteResolve in RT3:
1. Custom field creation
First create a new custom field: Configuration -> Custom Fields -> Create
Name: MuteResolve
Description: If Yes, don't send email notifications on resolve
Type: Select one value
(but I prefer Combobox because it looks better)
Applies to: Ticket Transactions
Validation: (?#YesNo)^(Yes|No|\z)$ (only necessary for Combobox)
When you click on "Save Changes" RT will let you enter Values.
Enter one value: "Yes". You need only fill the Name field, I have left Sort and Description empty. Then "Save Changes" again.
On the "Applies To" page select the queues where you want to enable the custom field, then on the "Group Rights" give the "ModifyCustomField" right to the "Privileged" system group.
2. Editing Scrip
Go to Configuration -> Global -> Scrips, then click on "On Resolve Notify Requestors"
Change "Condition" from "On Resolve" to "User Defined".
Change "Stage" from "TransactionCreate" to "TransactionBatch".
In the "Custom condition" box enter this code:
# is this a resolve? my $trans = $self->TransactionObj; my $tipo = $trans->Type; return 0 unless ($trans->Type eq "Status" && $trans->NewValue eq "resolved"); # get last "comment" transaction my $Transactions = $self->TicketObj->Transactions; $Transactions->Limit( FIELD => 'Type', VALUE => 'Comment' ); $Transactions->OrderByCols ( { FIELD => 'Created', ORDER => 'DESC' }, { FIELD => 'id', ORDER => 'DESC' }, ); # get custom fields of the last "comment" transaction, if there is one unless( $Transactions->First ){ return 1; } my $TransNum = $Transactions->First->Id; my $TCustomFields = $Transactions->First->CustomFields; while (my $TCustomField = $TCustomFields->Next()) { my $nam = $TCustomField->Name; if ($nam = 'MuteResolve') { my $val = $Transactions->First->FirstCustomFieldValue($nam); if ($val eq 'Yes') { return 0; } } } return 1;
That's all folks!
Note - I think
if ($nam = 'MuteResolve') {
should be
if ($nam eq 'MuteResolve') {
(added by fish, 9 Sep 2010)
Note2 - If you check "yes" but add no comment, rt still sends the mail. (Thx to Crist.)
(added by Minifab, 23 Nov 2010)