[rt-users] Scrip send email on create
Jeremy Burke
jburke at crypticstudios.com
Tue Feb 3 20:55:29 EST 2009
I think you need 2 scrips. The scrip you have below and then another scrip to send e-mail on create to the AdminCCs. You need to make sure the Add AdminCC scrip you have below is executed before the scrip that sends to the AdminCCs.
I'm using RT 3.8.1 and this is how I have it setup to work. The 1 at the beginning of Scrip #2's description forces this scrip to be run before scrip #1
Scrip #1:
Description: On Create Notify AdminCcs
Condition: On Create
Action: Notify AdminCcs
Template: Global template: Transaction
Stage: Transaction Create
Custom condition: <empty>
Custom action preparation code: <empty>
Custom action cleanup code: <empty>
Scrip #2:
Description: 1 Add AdminCC
Condition: On Create
Action: User Defined
Template: Global Template: Blank
Stage: TransactionCreate
Custom condition: <empty>
Custom action preparation code: return 1;
Custom action cleanup code:
my $owner_id = $self->TicketObj->Owner;
my $requestor_email = $self->TicketObj->RequestorAddresses;
my $admincclist = $self->TicketObj->AdminCc;
my @actors = ('fred at company.com', 'wilma at company.com');
my $user = RT::User->new($RT::SystemUser);
if ( $self->TicketObj->Subject =~ m/Customer A/i ) {
foreach my $actor (@actors) {
$user->LoadByEmail($actor);
my $user_id = $user->Id;
my $user_email = $user->EmailAddress;
if ( $user_email ne $requestor_email )
{
my($status, $msg) = $admincclist->AddMember($user->Id);
unless( $status ) {
$RT::Logger->warning( "can't add ticket owner as Cc : msg" );
return undef;
}
}
}
} else {
return 0;
}
Hope this helps.
-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Dan O'Neill
Sent: Tuesday, February 03, 2009 4:52 PM
To: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] Scrip send email on create
Dan O'Neill wrote:
> Enclosed is a script that adds one or more AdminCC's to a ticket during
> Create. This does not cause the AdminCC's to receive an email.
>
> How do I modify this Scrip or otherwise configure the Queue such that
> AdminCC's will receive a copy of the text in the opening transaction?
>
> Here is the scrip information. I've reviewed the contributions page and
> read what I can before asking this question. Thanks for the help.
>
> Condition: On Create
> Action: User Defined
> Template: Global template: Blank
> Stage: Transaction Create
A little update. At the suggestion of some docs on the wiki, I added a
new template to see if that would get this scrip to send a notification
to the AdminCC's. Didn't work, still no outbound notification. I'll
whip up an Amazon gift certificate to anyone who can help me resolve
this problem before close of business Wednesday.
Thanks,
Dan
_______________________________________________
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