Remove AdminCc based on Custom Field Value

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 :slight_smile:

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

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

[…]

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 ?

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