[rt-users] scrip for updating ticket info

Ken Crocker kfcrocker at lbl.gov
Wed Dec 16 14:09:00 EST 2009


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
LBNL

On 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 at lbl.gov 
> <mailto:kfcrocker at 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 at bestpractical.com <mailto:sales at 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 at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20091216/0cfe9373/attachment.htm>


More information about the rt-users mailing list