[rt-users] Adding AdminCCs on ticket creation

JC Boggio rt-users at thefreecat.org
Wed Nov 18 04:15:50 EST 2009


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 at somedomain.com'
	,'other at 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 at 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



More information about the rt-users mailing list