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

Kevin Falcone falcone at bestpractical.com
Mon Jul 27 14:59:30 EDT 2009


On Mon, Jul 27, 2009 at 12:04:33PM -0400, Mchugh, Sean wrote:
> on thursday, july 23, 2009 10:26 am, kevin falcoe wrote:
> > > 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)
> 
> 
> Thanks Kevin.  One question:  after making 'On Create NotifyAdminCc'
> user defined,
> what must I drop into the Custom Action to actually keep the former
> behavior ?  Can I just
> copy from the perl source ?

The RT source that covers that is relatively complex and buried.
You'll need to look at the TransactionObj's Type
I'd be surprised if there wasn't some sample code for that on the wiki

-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
> > >
> > _______________________________________________
> > 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
> _______________________________________________
> 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