OnOwnershipSquelchMailtoQueueWatchers: Difference between revisions
Jump to navigation
Jump to search
m (2 revisions imported) |
(No difference)
|
Latest revision as of 15:15, 6 April 2016
This is a scrip action that I found multiple requests for while I was looking for it myself, but I couldn't find any example of code that did what I wanted it to do:
If a ticket goes from being owned by "Nobody" to being owned by a regular user, anyone who is just an AdminCc because they are assigned as a Watcher for that Queue. If they're the Requestor, Owner, or have been assigned as a CC or AdminCc for the ticket itself, they keep getting mail.
Scrip fields
- Description: On Initial Ownership Remove Queue Watchers
- Condition: User Defined
- Action: User Defined
- Template: Global template: Blank
- Stage: Transaction Create
User Defined conditions and actions
Custom Condition: (from Custom Condition Snippets)
my $txn = $self->TransactionObj; return 0 unless $txn->Type eq "Set"; return 0 unless $txn->Field eq "Owner"; return 0 unless $txn->OldValue == $RT::Nobody->id; return 1;
Custom action preparation code:
return 1;
Custom action cleanup code:
my $t = $self->TicketObj; my $q = $self->TicketObj->QueueObj; my $q_accs = $q->AdminCc->UserMembersObj; while (my $q_u = $q_accs->Next) { unless ($t->IsAdminCc($q_u->id) or $t->IsCc($q_u->id) or $t->IsRequestor($q_u->id) or $t->IsOwner($q_u)) { $t->SquelchMailTo($q_u->EmailAddress); } } return 1;