[rt-users] set default priority

Dirk Pape pape-rt at inf.fu-berlin.de
Tue Jun 6 15:33:51 EDT 2006


Hello,

--Am 6. Juni 2006 15:52:55 +0000 schrieb Mohamed Ali Bouirmane 
<ali.bouirmane at marocconnect.com>:

> I want to set a default priority when a user (support level 1) create
> ticket in specific queue .
>
> And
>
> I want to set a priority when users select a value in custom field

i can send you an example (attached) of a scrip we test with, it adjusts 
priority of a ticket if specific custom fields of the tickets are set.

With this scrip we experiment calculating priority automatically from 
queue's initial and final priority and custom field values for 
Dringlichkeit (urgency) and Wichtigkeit (importance). Not yet ready for 
production but might help you as example.

Regards, Dirk.
-------------- next part --------------
Condition: On Transcation

Custom action preparation code:

my $type = $self->TransactionObj->Type;
return(0) unless $type eq "CustomField" or $type eq "Create";
return(1);

Custom action cleanup code:

my $ticket = $self->TicketObj;
my $queue = $ticket->QueueObj;
my $wichtig = $ticket->FirstCustomFieldValue("Wichtigkeit");
my $dringlich = $ticket->FirstCustomFieldValue("Dringlichkeit");
my $minprio = $queue->InitialPriority;
my $maxprio = $queue->FinalPriority;
my %w_value = ( "niedrig" => 0, "mittel" => 1, "hoch" => 2 );
my %d_value = ( "klein" => 0, "mittel" => 1, "hoch" => 2 );
my $d_weight = ($maxprio - $minprio) / 3;
my $w_weight = $d_weight / 3;
my $d = $d_value{$dringlich} || 0;
my $w = $w_value{$wichtig} || 0;
my $prio = $minprio + $d_weight * $d_value{$dringlich} + $w_weight * 
$w_value{$wichtig};
$RT::Logger->info("would set Prio $prio by Dringlichkeit 
".$d_value{$dringlich}." and Wichtigkeit ".$w_value{$wichtig});
$ticket->_Set(Field => "Priority", Value => $prio, RecordTransaction => 0);
$RT::Logger->info("Prio is now ".$ticket->Priority);
return(1);


More information about the rt-users mailing list