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

Kevin Falcone falcone at bestpractical.com
Thu Jul 23 10:26:19 EDT 2009


On Tue, Jul 21, 2009 at 06:11:50AM -0400, Mchugh, Sean wrote:
> 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:

I suspect you're running into a problem distinguishing AdminCcs on the
Queue level vs the Ticket level.

Instead of trying to remove the AdminCcs, I'd put a User Defined
condition on the default "On Create Notify AdminCc" that returns false
if your CF is set, just make sure the CF gets set first and you may
need to make some of the Scrips be TransactionBatch (see the config
file)

-kevin

> 
> 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
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
> 
> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
> 



More information about the rt-users mailing list