[Rt-devel] Setting priority on create based on CF value Scrip

Dániel Omaisz-Takács otdmunka at gmail.com
Tue Apr 21 06:41:58 EDT 2009


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 =(  Perl.org 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 )
 {
 $self->TicketObj->SetPriority(71);
 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.
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bestpractical.com/pipermail/rt-devel/attachments/20090421/b60fe812/attachment.htm 


More information about the Rt-devel mailing list