Custom priority on tickets with subject containing keyword

Hi,

Is any way to set a ticket priority based on the subject?
I searched but couldn’t find any solution.

Thanks!

You could use scrip to do that potentially. You have a $TicketObj in those that you can get the subject from, pattern match on and then set the priority. Bear in mind that if you set the priority in a transaction that can itself fire off other scrips. If you wanted this update to be “silent” you can set the priority without creating a transaction using something like:

$TicketObj->_Set(Field => 'Priority', Value => 90, RecordTransaction => 0);

Hi,

Thanks GreenJimll.

After I opened the ticket, I continued to search and found this page Contributions - Request Tracker Wiki and used some examples from there and adapted for my need to create a scrip.

My solution is:
Condition: On create
Action: User defined
Template: blank

Custom action preparation code:

my $match = "text to look for";
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject !~ /$match/i ) {
   return 0;
}
else {
   return 1;
}

Custom action commit code:

my $t_subject = $self->TicketObj->Subject;
$RT::Logger->info("Auto set ticket #". $self->TicketObj->id ." priority to Major");
my ($set_priority, $msg) = $self->TicketObj->SetPriority(100);
unless ( $set_priority ) {
     $RT::Logger->error( "Unable to set priority to Major" );
     $RT::Logger->error( "Message: $msg" );
   }
return 1;