Global scrip to auto change queue on Create

Hi,

Using RT 6.0 here. Creating a global level scrip to autochange new created tickets to their respective queues by keyword scanning on subject and content.

Condition: On Create
Custom preparation code:

my $Ticket= $self->TicketObj;
return 1 if ( $Ticket->Subject =~ m/(?i)(network|server|data storage|disaster recovery|hardware|software installation|system access|IT environment)/ || $Ticket->Content =~ m/(?i)(network|server|data storage|disaster recovery|hardware|software installation|system access|IT environment)/ );

Custom commit code:

my $Ticket= $self->TicketObj;
$Ticket->SetQueue(‘IT Infrastructure’);
$RT::Logger->info(“Ticket " . $Ticket->id . " routed to IT Infrastructure queue.”);
return 1;

Applies to: Normal

I have inserted keywords within both the subject and body of the email. Somehow it’s not working.

Is there something I am missing?

What do you see in the logs? I don’t believe Content is a valid ticket method

Print to the logger other info message at the end of the preparation code to see if the line before is doing what you expect.

Also, use my ($status, $msg) = $Ticket->SetQueue(‘IT Infrastructure’); so you can check if something goes wrong by adding…

unless( $status ) {
  $RT::Logger->error(“Something goes wrong: ”. $msg);
  return 0;
}

Or whatever structure/logic you prefer, and watch the log file.

a similar condition i use with rt 5.0.8:

Condizione:   Alla creazione
Azione:       Definito dall'utente
Modello:      Blank - ITA
Si applica a: Assistenza

Programma di preparazione dell'azione personalizzata:
my $requestor_email = lc($self->TicketObj->RequestorAddresses);
my $t_subject = lc($self->TicketObj->Subject);
my $t_content = lc($self->TransactionObj->Attachments->First->Content);

if ( $t_subject =~ "marcatemp" ) {
     $self->TicketObj->SetQueue(7);
     return 1;
}
if ( $t_content =~ "marcatemp" ) {
     $self->TicketObj->SetQueue(7);
     return 1;
}
if ( $requestor_email =~ "aaa.it") {
     $self->TicketObj->SetQueue(6);
     return 1;
}

return 1;

Custom action commit code:
$self->TicketObj -> SetPriority("Medium");

Thanks a lot. Problem solved