Adding AdminCCs on ticket creation

Hello,

I need the following behaviour : when a ticket is created (in default queue),
if the suject contains “[PRH]” I must notify some special persons.

I first tried to change the ticket’s queue but only the AdminCCs of the
default queue are notified.

So I tried adding the users during the creation process with this scrip :

Condition: during a transaction
Action: user defined
Template: Null
Stage: TransactionCreate

Custom action preparation code:

my $Ticket=$self->TicketObj;
my $Transaction = $self->TransactionObj;
if ($Ticket->Subject =~ /[PRH]/) {
$Ticket->SetQueue(20);
my $admincclist = $Ticket->AdminCc;
my $user = RT::User->new($RT::SystemUser);

my @comptes = (
‘someone@somedomain.com’
,‘other@somedomain.com’
);

foreach my $c(@comptes) {
$user->LoadByEmail($c);
$admincclist->AddMember($user->Id);
}

}
return 1;

Everything works but TOO LATE : ticket is moved to queue 20 and
AdminCCs are added to the ticket but they don’t get the initial
(ticket creation ACK) email :

Fri Nov 06 14:59:41 2009: Request 3482 was acted upon.
Transaction: Ticket created by jcboggio
Queue: Default queue
Owner: Nobody
Requestor: jcboggio@somedomain.com
�tat: new
Ticket <URL: https://rt.somedomain.com/rt/Ticket/Display.html?id=3482 >

All the persons in the BCC are those from default queue.

How can I do this ? Can I re-emit this email afterwards ? any solution
is acceptable : my boss puts me under high pressure on this topic.

Thanks for your help,

JC

JC,

I created something similar to this only it was for Ticket “CC’s”. As to
whether you want them to be added as Users or not, that could well be
done with your RT_SiteConfigure.pm file for auto create. We do that and
they become non-privileged users (Email only.
Anyway, I didn’t want RT to add “CC’s” automatically for all queues, so
I wrote this scrip to do it on a queue by queue basis. I put it in the
RT wiki. If you’re interested, you could check it out and modify it for
your purposes. Hope it helps.

Kenn
LBNL

P.S. I noticed your code didn’t have a "Return 1: in the Cleanup Action
Code. That is important as well.On 11/18/2009 1:15 AM, JC Boggio wrote:

Hello,

I need the following behaviour : when a ticket is created (in default queue),
if the suject contains “[PRH]” I must notify some special persons.

I first tried to change the ticket’s queue but only the AdminCCs of the
default queue are notified.

So I tried adding the users during the creation process with this scrip :

=================================
Condition: during a transaction
Action: user defined
Template: Null
Stage: TransactionCreate

Custom action preparation code:

my $Ticket=$self->TicketObj;
my $Transaction = $self->TransactionObj;
if ($Ticket->Subject =~ /[PRH]/) {
$Ticket->SetQueue(20);
my $admincclist = $Ticket->AdminCc;
my $user = RT::User->new($RT::SystemUser);

my @comptes = (
‘someone@somedomain.com’
,‘other@somedomain.com’
);

foreach my $c(@comptes) {
$user->LoadByEmail($c);
$admincclist->AddMember($user->Id);
}

}
return 1;

Everything works but TOO LATE : ticket is moved to queue 20 and
AdminCCs are added to the ticket but they don’t get the initial
(ticket creation ACK) email :

Fri Nov 06 14:59:41 2009: Request 3482 was acted upon.
Transaction: Ticket created by jcboggio
Queue: Default queue
Subject: Test [PRH] - NE PAS REPONDRE
Owner: Nobody
Requestor: jcboggio@somedomain.com
�tat: new
Ticket <URL: https://rt.somedomain.com/rt/Ticket/Display.html?id=3482 >

All the persons in the BCC are those from default queue.

How can I do this ? Can I re-emit this email afterwards ? any solution
is acceptable : my boss puts me under high pressure on this topic.

Thanks for your help,

JC


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Ken,

Ken Crocker a �crit :

I created something similar to this only it was for Ticket “CC’s”.

I’ve found two interesting pages on the wiki, this one being the
solution :

http://wiki.bestpractical.com/view/AddWatcherPerTicket

This one is quite interesting too :

http://wiki.bestpractical.com/view/ScripExecOrder

Thanks for pointing me there.