[rt-users] Remove AdminCc based on Custom Field Value

Mchugh, Sean SMchugh at grey.com
Tue Jul 21 06:11:50 EDT 2009


I have a queue that records backup job status.  When a notification
comes in for a successful job, I don't want to send out a Notify Admins
email (Global Scrip #4);

so, since I can determine a successful job based on the custom field
NB_STATUS, which is transmitted
in the body of the message, I would like to delete all AdminCc users.

Here's what I have in my custom scrip:

my $nbstatus = $self->TicketObj->FirstCustomFieldValue('NB_STATUS');
if ($nbstatus == 0) { 
                  my $admincc = $self->TicketObj->AdminCcAddresses;
                  my @watchers = split /\,/,$admincc;
                  $RT::Logger->warning("Scrip 12 found watchers:
$admincc");
                  foreach my $watcher (@watchers) {
                     my ($st, $msg) =
$self->TicketObj->DeleteWatcher(Type=>'AdminCc',Email=>$watcher);
                  }
                  $self->TicketObj->SetStatus('resolved');
           
}


The ticket status is set correctly, but I can't seem to get any of the
'Watcher' related code to work;

1.) AdminCcAddresses returns nothing
2.) This custom scrip's description starts with a 00 and is set for
TransactionBatch, as is Scrip #4; and
    I can see in the ticket history, that my custom scrip is executing
before the Notify Admins scrip
3.) The AdminCc is set on the Queue that this custom scrip executes on
and points to a group.

Any help would be greatly appreciated :)





Sean McHugh
VP, Dir. of Global Services
Grey Group
p. 212-546-1926
m. smchugh at grey.com
c. 917-916-8644




More information about the rt-users mailing list