[rt-users] Modifying watchers list after ownership change

Craig Stacey stace at mcs.anl.gov
Mon Jan 28 14:44:04 EST 2013


Trying to solve the problem below.  I've been asked to modify a queue such that:

> When a ticket comes in unclaimed, mail should go to all admins.
> However, when the ticket is claimed then only the owner of the ticket gets any further mail.

I found what claims to be a solution to this in the archives from 2009, but I can't get the behavior I'm expecting.  This is a stock RT 3.8 instance (ie, no hacks to mail functions).  Here's the config and script:

===

Condition: On Owner Change
Action: User Defined
Template: Blank
Stage: TransactionCreate

Custom Condition:

Custom action preparation code:

foreach my
$address($self->TicketObj->QueueObj->Cc->MemberEmailAddresses){
 $self->TicketObj->SquelchMailTo($address);
}
if($self->TicketObj->OwnerObj->Id != $RT::Nobody->id){
 $self->TicketObj->AddWatcher(
   Type=>"AdminCc",
   PrincipalId=>$self->TicketObj->OwnerObj->Id
 );
}
$self->TicketObj->UnsquelchMailTo($self->TicketObj->OwnerObj->EmailAddress);

Custom action cleanup code:

===

It seems to work, in that when I look at the ticket, I see the ticket owner explicitly listed as AdminCc, but it does not seem to squelch the mail to the other AdminCcs (the default watcher group), so all the admins still get traffic on the ticket.

Any ideas?


More information about the rt-users mailing list