AddAdminCcAndChangeQueue

From Request Tracker Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

On a queue with several adminCCs there was one slightly different task that needed to included one other person. Rather than create a second queue with its own list of Admin CC's and require everyone to watch two queues we made a second queue and added this script to move the tickets to the main queue. The web form for the special jobs routes them to the special queue, where the script adds the adminCC and changes the assigned queue to the main queue.

 Description: AddAdminCC and change queue
 Condition: On Create
 Action: User Defined
 Template: Global Template: Admin Comment
 Stage: Transaction Create
 Custom Action Prep Code:
 
 return 1;
 
 Custom Action Cleanup Code:
 
 # add adminCC
 my $admincclist = $self->TicketObj->AdminCc;
 my $user = RT::User->new($RT::SystemUser);
 $user->LoadByEmail('somebody@somewhere.com');
 $admincclist->AddMember($user->Id);
 
 # Change queue
 my $newqueue = "some_queue_number";
 my $T_Obj = $self->TicketObj;
 
 $RT::Logger->info("Auto assign ticket #". $T_Obj->id ." to queue #". $newqueue );
 my ($status, $msg) = $T_Obj->SetQueue($newqueue);
 unless ($status) {
     $RT::Logger->warning("unable to set new queue: $msg");
     return undef;
 }
 return 1;