[rt-users] Custom Scrip for ticket move
Emmanuel Lacour
elacour at easter-eggs.com
Mon Nov 2 08:15:32 EST 2009
On Wed, Oct 28, 2009 at 09:02:09AM -0400, Juan N. DLC wrote:
> Hi to all,
>
> I want to know if someone have a scrip that make a ticket get the priority
> and duedate from the queue is moving to.
>
> ej.
>
> Ticket#001 in queue#1 with duedate 1/priority 3
>
> Ticket#001 have now a dudedate1 and priority 3
>
> when the Ticket#001 is moved to queue#2 with duedate 3 / priority 1 - The
> ticket still have the queue#1 duedate/priority settings.
>
> Can some one be so kind to point me to the right direction here or can give
> me a scrip for this.
>
You have to create a scrip "On queue change", in this scrip, get the new
queue
something like this:
my $queue_id = $self->TransactionObj->NewValue;
my $queue = RT::Queue->new( $RT::SystemUser );
$queue->Load($queue_id);
get values for duedate and priority:
$queue->DefaultDueIn;
$queue->InitialPriority;
use those values to set them on the ticket:
# Priority
$self->TicketObj->SetPriority($queue->InitialPriority);
# Due Date
my $due_date = RT::Date->new($RT::SystemUser);
$due_date->Set(Format => 'ISO', Value => $self->TicketObj->Due);
$due_date->AddDays($queue->InitialPriority);
$self->TicketObj->SetDue($due_date->ISO);
More information about the rt-users
mailing list