Send AdminCc notify email from inside custom action?

I have been looking to implement automatic Cc adds for new users copied into
threads, taking the code here and adapting it:
http://wiki.bestpractical.com/view/AddWatchersOnCorrespond#

I have created 2 custom scrips based on that, one that triggers on Create
and another on Correspond. (I am not using $ParseNewMessageForTicketCcs
because I only want this on specific queues).

The add-Cc’s function is working perfectly. However, we like to generate an
email notify whenever we have made a change to a ticket’s state. I am trying
to find a way to generate an AdminCc notification that one or more Cc’s were
added to the ticket, and I would assume that needs to happen within the
custom action cleanup code, after the Cc-add processing has been finished.

I’ve looked around on the wiki, Google, and looked through O’Reilly’s “RT
Essentials” book on Safari Online, but I can’t see a way to make this
happen. I’ve tried getting the AdminCc list with code similar to this:

$adminccs = $self->TicketObj->AdminCcAddresses;

But I get a blank return using that. I’ve also tried using RT::User->new and
grabbing data from the returned object, but I get Perl errors about the
method not being implemented (even if I “use RT::User”).

All I really need is either a way to get the admincc list, and then a way to
send an email, or a packaged-up method that knows how to get the admincc
list itself, that I can pass a message text to. Does such an animal exist?

Thanks in advance for any help. I feel like I’m beating my head against a
wall at this point.

Dan

Hi Dan,

The only way I was able to figure out to send an e-mail as part of a
user-defined action scrip is to have the scrip that does the user-defined
action also set a value in another field, and have that field change
trigger a Notify scrip. We don’t use ticket priorities here, so I use the
priority field to control process flow (I’ve also done the same thing using
a custom field). In your case, I’d have your scrip add someone to the
ticket’s admincc group and then set a value in a CF called “Flow”. Then
I’d create another scrip that triggers when “Flow” changes to that specific
value; this scrip would do the notification.

I’m sure there are more elegant ways to do this, but I never found them and
this works for us.

Regards,
Gene

At 08:12 AM 7/18/2008, Dan Lowe wrote:

I have been looking to implement automatic Cc adds for new users copied
into threads, taking the code here and adapting it:

http://wiki.bestpractical.com/view/AddWatchersOnCorrespond#AddWatchersOnCorrespond - Request Tracker Wiki

I have created 2 custom scrips based on that, one that triggers on Create
and another on Correspond. (I am not using $ParseNewMessageForTicketCcs
because I only want this on specific queues).

The add-Cc’s function is working perfectly. However, we like to generate
an email notify whenever we have made a change to a ticket’s state. I am
trying to find a way to generate an AdminCc notification that one or more
Cc’s were added to the ticket, and I would assume that needs to happen
within the custom action cleanup code, after the Cc-add processing has
been finished.

I’ve looked around on the wiki, Google, and looked through O’Reilly’s “RT
Essentials” book on Safari Online, but I can’t see a way to make this
happen. I’ve tried getting the AdminCc list with code similar to this:

$adminccs = $self->TicketObj->AdminCcAddresses;

But I get a blank return using that. I’ve also tried using RT::User->new
and grabbing data from the returned object, but I get Perl errors about
the method not being implemented (even if I “use RT::User”).

All I really need is either a way to get the admincc list, and then a way
to send an email, or a packaged-up method that knows how to get the
admincc list itself, that I can pass a message text to. Does such an
animal exist?

Thanks in advance for any help. I feel like I’m beating my head against a
wall at this point.

Dan

Gene LeDuc, GSEC
Security Analyst
San Diego State University