Setting priority on create based on CF value Scrip

Hi all, i need to set the priority based on a ticket CF that the user sets
at selfservice during the ticket submission.
Its set up so that the user can submit to only one queue: General
CF’s name: Sürgősség (Priority in Hungarian, need that so for the end users
use Hungarian…)

I’m very new on this, tried researching the rt wiki & i have the RT
essentials book, but both seem outdated =( is some help but still
And i cant figure it out what’s wrong. Please help.

I set up a Scrip with the following at Config/Queues/General/Scrips:

Scrip Fields:
Description: Condition: - On Close On Comment On Correspond On Create On
Owner Change On Priority Change On Queue Change On Reopen On Resolve On
Status Change On Transaction User Defined Action: - Autoreply To Requestors
Create Tickets Extract Subject Tag Notify AdminCcs Notify AdminCcs as
Comment Notify Ccs Notify Ccs as Comment Notify Other Recipients Notify
Other Recipients as Comment Notify Owner Notify Owner as Comment Notify
Requestors Notify Requestors and Ccs Notify Requestors and Ccs as
Comment Notify
Requestors, Ccs and AdminCcs Notify Requestors, Ccs and AdminCcs as
Comment Open
Tickets User Defined Template: - Global template: Admin Comment Global
template: Admin Correspondence Global template: Admin-new-outdated Global
template: Autoreply Global template: Blank Global template:
Correspondence Global
template: Email Digest Global template: Error to RT owner: public key Global
template: Error: bad GnuPG data Global template: Error: Missing
dashboard Global
template: Error: no private key Global template: Error: public key Global
template: Forward Global template: PasswordChange Global template:
Resolved Global
template: Status Change Global template: Transaction Stage: TransactionCreate
TransactionBatch Disabled

Custom action preparation code:

return 1;

Custom action cleanup code:

my $CFName = ‘Sürgősség’;

if ( $self->TicketObj->FirstCustomFieldValue($CFName) =~ /Kritikus/i )
$self->TicketObj->SetPriority( 85 );
return 1;
} else {
if ( $self->TicketObj->FirstCustomFieldValue($CFName) =~ /Súlyos/i )
return 1;
} else {
if ( $self->TicketObj->FirstCustomFieldValue($CFName) =~ /Magas/i )
$self->TicketObj->SetPriority( 41 );
return 1;
} else {
if ( $self->TicketObj->FirstCustomFieldValue($CFName) =~ /Közepes/i )
$self->TicketObj->SetPriority( 21 );
return 1;
} else {
if ( $self->TicketObj->FirstCustomFieldValue($CFName) =~ /Alacsony/i )
$self->TicketObj->SetPriority( 0 );
return 1;
} else { return undef; }
return 0;

It wont do nothing at all, i’m not even sure of if it runs down or not.

Thankyou in advance.

Found the solution, i did it all wrong :slight_smile:

The working code is: / line start with # are comments DO NOT paste them :slight_smile:

#Get CF value
my $cf_va = $self->TicketObj->FirstCustomFieldValue(‘Priority’);

#Set Priority number based on the text value set by the end user
my $pri_va = “”;
$pri_va = “85” if ($cf_va =~ /^C/); #Critical
$pri_va = “71” if ($cf_va =~ /^V/); #Very High
$pri_va = “41” if ($cf_va =~ /^H/); #High
$pri_va = “21” if ($cf_va =~ /^M/); #Medium
$pri_va = “0” if ($cf_va =~ /^L/); #Low

#end set the priority!