Scrip for updating ticket info

Hi,

Is it possible to have a scrip to modify the due date & priority of a ticket
each time is moved from queue to queue?

Thanks

Hi,

Is it possible to have a scrip to modify the due date & priority of a ticket
each time is moved from queue to queue?

Yes. On the wiki you can find OnQueueChange condition. Scrip action
for priority change is described in WritingScripActions article.

Thanks


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Best regards, Ruslan.

Juan

We re-set the owner of a ticket when it moves to another Queue. This is
what we use:

Condition: On Queue Change

Custom action preparation code:

return 1;

Custom action cleanup code:

set new Ticket Owner value

my $ticket = $self->TicketObj;

$ticket->SetOwner(10, ‘Force’);

return 1;

Just modify it to change the ticket fields you want change and that
should do it.
Hope this helps.

Kenn
LBNLOn 12/16/2009 6:45 AM, Juan N. DLC wrote:

Hi,

Is it possible to have a scrip to modify the due date & priority of a
ticket each time is moved from queue to queue?

Thanks


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Thanks guys!

Ken,

I’m not that expert creating scrips, but I do understand the scrip below but
I don’t know how to edit it to set the values that I need. How to I get the
values from the queue moving to and apply it to the ticket.

ThanksOn Wed, Dec 16, 2009 at 1:08 PM, Ken Crocker kfcrocker@lbl.gov wrote:

Juan

We re-set the owner of a ticket when it moves to another Queue. This is
what we use:

Condition: On Queue Change

#----------------------------------------------------------------------------

Custom action preparation code:

#----------------------------------------------------------------------------

return 1;

#----------------------------------------------------------------------------

Custom action cleanup code:

#----------------------------------------------------------------------------

set new Ticket Owner value

my $ticket = $self->TicketObj;

$ticket->SetOwner(10, ‘Force’);

return 1;

Just modify it to change the ticket fields you want change and that should
do it.
Hope this helps.

Kenn
LBNL

On 12/16/2009 6:45 AM, Juan N. DLC wrote:

Hi,

Is it possible to have a scrip to modify the due date & priority of a
ticket each time is moved from queue to queue?

Thanks


_______________________________________________http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Juan,

I don’t understand your question. Edit what? If you have the data you
want to put into the ticket (and I assume you do or you can get it) then
just put the data into the filed the ticket uses, like this:

Turns into yyyy-mm-dd format for date conversion by RT::Date

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $cf_date = $ticket->FirstCustomFieldValue(‘Need-By Date’);

split up the date parts into a temporary array

my @parts = split(/[/-]/, $cf_date);

put date parts back together

my $date = sprintf("%d-%d-%d", $parts[2], $parts[0], $parts[1]);

my $duedate = RT::Date->new($RT::SystemUser);
$duedate->Set(Format=>‘unknown’, Value=>$date);

$ticket->SetDue($duedate->ISO);

The above sets the due date with the date I got from a custom field
called “Need-By Date”. Just put in your data field.

$ticket->SetPriority(“1”);

The above sets the ticket priority to 1. You can set it to what you want.

I really don’t what your data is or where it’s coming from so I can’t
tell you any more.
Hope this helps.

Kenn
LBNLOn 12/16/2009 10:46 AM, Juan N. DLC wrote:

Thanks guys!

Ken,

I’m not that expert creating scrips, but I do understand the scrip
below but I don’t know how to edit it to set the values that I need.
How to I get the values from the queue moving to and apply it to the
ticket.

Thanks

On Wed, Dec 16, 2009 at 1:08 PM, Ken Crocker <kfcrocker@lbl.gov mailto:kfcrocker@lbl.gov> wrote:

Juan

We re-set the owner of a ticket when it moves to another Queue.
This is what we use:

Condition: On Queue Change

#----------------------------------------------------------------------------
# Custom action preparation code:
#----------------------------------------------------------------------------

return 1;

#----------------------------------------------------------------------------
# Custom action cleanup code:
#----------------------------------------------------------------------------
# set new Ticket Owner value

my $ticket = $self->TicketObj;

$ticket->SetOwner(10, 'Force');

return 1;


Just modify it to change the ticket fields you want change and
that should do it.
Hope this helps.

Kenn
LBNL


On 12/16/2009 6:45 AM, Juan N. DLC wrote:
Hi,

Is it possible to have a scrip to modify the due date & priority
of a ticket each time is moved from queue to queue?

Thanks
------------------------------------------------------------------------
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com <mailto:sales@bestpractical.com> Discover
RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a
copy at http://rtbook.bestpractical.com


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com