[rt-users] Due dates based on custom fields
Roedel, Mark
MarkRoedel at letu.edu
Wed Jan 20 12:34:03 EST 2010
We have an "Urgency" custom field in one of our queues, and I wrote a couple of scrips to set the ticket due date and starting and ending priorities based on that field's value. (One scrip fires on ticket creation, and one fires on a change to the custom field's value.)
The scrip configuration for the ticket creation one looks like:
Condition: On Create
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate
Custom Action Preparation Code:
Return (1);
Custom Action Cleanup Code
my $ticket = $self->TicketObj;
my $CFName = 'Urgency';
my $QueueObj = $self->TicketObj->QueueObj;
my $CFObj = RT::CustomField->new ($QueueObj->CurrentUser);
my $duedate = RT::Date->new($RT::SystemUser);
my $bus_hours_duetime = time;
use Business::Hours;
my $hours = Business::Hours->new();
my $now = time;
$CFObj->LoadByNameAndQueue(Name=>$CFName, Queue=>$QueueObj->id);
unless ($CFObj->id) {
$RT::Logger->warning ("$CFName doesn't exist in Queue " . $QueueObj->Name);
return undef;
}
my $urgencyvalue = $self->TicketObj->FirstCustomFieldValue($CFObj->id);
if ($urgencyvalue eq 'Emergency') {
$self->TicketObj->SetPriority('100');
$self->TicketObj->SetFinalPriority('100');
$bus_hours_duetime = $hours->add_seconds ($now, 14400);
$duedate->Set(Format=>'unix', Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
} elsif ($urgencyvalue eq 'Urgent') {
$self->TicketObj->SetPriority('90');
$self->TicketObj->SetFinalPriority('99');
$bus_hours_duetime = $hours->add_seconds ($now, 32400);
$duedate->Set(Format=>'unix', Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
} elsif ($urgencyvalue eq 'Time-Sensitive') {
$self->TicketObj->SetPriority('89');
$self->TicketObj->SetFinalPriority('89');
$bus_hours_duetime = $hours->add_seconds ($now, 97200);
$duedate->Set(Format=>'unix', Value=>$bus_hours_duetime);
$self->TicketObj->SetDue($duedate->ISO);
} elsif ($urgencyvalue eq 'High') {
$self->TicketObj->SetPriority('75');
$self->TicketObj->SetFinalPriority('88');
$duedate->Set(Format=>'unknown', Value=>'15 days');
$self->TicketObj->SetDue($duedate->ISO);
} elsif ($urgencyvalue eq 'Medium') {
$self->TicketObj->SetPriority('50');
$self->TicketObj->SetFinalPriority('74');
$duedate->Set(Format=>'unknown', Value=>'3 months');
$self->TicketObj->SetDue($duedate->ISO);
} elsif ($urgencyvalue eq 'Low') {
$self->TicketObj->SetPriority('25');
$self->TicketObj->SetFinalPriority('49');
$duedate->Set(Format=>'unknown', Value=>'6 months');
$self->TicketObj->SetDue($duedate->ISO);
} elsif ($urgencyvalue eq 'Very Low') {
$self->TicketObj->SetPriority('1');
$self->TicketObj->SetFinalPriority('24');
$duedate->Set(Format=>'unknown', Value=>'1 year');
$self->TicketObj->SetDue($duedate->ISO);
} else {
}
return(1);
(The Business::Hours library is used by the first three urgency values to ensure that short-term tickets come due during our working hours.)
--
Mark Roedel
Webmaster
LeTourneau University
-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Jose de Paula Eufrasio Junior
Sent: Tuesday, January 19, 2010 10:54 PM
To: rt-users
Subject: [rt-users] Due dates based on custom fields
So, I want to use custom fields to classify the tickets on the support
queue as some pre-defined services. Each service has a defined SLA. I
am also using escalation of tickets based on due date. Is there
anything out that can define the due date of tickets based on those
custom fields? I saw the SLA extension but it looks like SLA per
queue, while what I want is per ticket.
--
José de Paula Eufrásio Júnior (coredump)
MCSO, GRC Professional
http://core.eti.br
More information about the rt-users
mailing list