I have the following code snippet from an exteral program. It queries all
tickets in a particular queue and changes priority and owner if it hasn’t
been touched in an hour.
Do I have the syntax for setting a new owner correct? What’s the way to
change priority?
Get hold of new and open tickets only
my $tickets = new RT::Tickets($RT::SystemUser);
$tickets->LimitStatus(VALUE => ‘new’);
$tickets->LimitQueue(VALUE => $queue->Id);
$tickets->LimitPriority(OPERATOR => ‘<’, VALUE => “10”);
Process each ticket
while (my $ticket = $tickets->Next) {
if ((time()-$ticket->LastUpdatedObj->Unix)/3600 >= $idleTime) {
$ticket->SetOwner($ownerNames[$newOwner]);
change priority?
$ticket->SetPriority($newPri);
}
}
See “Simple example” and last snippet from “code snippets” in
http://wiki.bestpractical.com/index.cgi?WriteCustomAction
matthew zeier wrote:
Ruslan Zakirov wrote:
See “Simple example” and last snippet from “code snippets” in
Request Tracker Wiki
That appears geared towards scrips and not external perl scripts but
nonetheless I looked at it appears that my syntax is correct however, I
printed out the status and error message and see:
status: 0, You can only reassign tickets that you own or that are unowned
Script is running as root - can I not have RT give the ticket directly
instead of stealing it like:
my ($status, $msg) = $ticket->SetOwner( $newOwner, “Steal”);
?
matthew zeier wrote:
I have the following code snippet from an exteral program. It queries
all tickets in a particular queue and changes priority and owner if it
hasn’t been touched in an hour.
Do I have the syntax for setting a new owner correct? What’s the way
to change priority?
Get hold of new and open tickets only
my $tickets = new RT::Tickets($RT::SystemUser);
$tickets->LimitStatus(VALUE => ‘new’);
$tickets->LimitQueue(VALUE => $queue->Id);
$tickets->LimitPriority(OPERATOR => ‘<’, VALUE => “10”);
Process each ticket
while (my $ticket = $tickets->Next) {
if ((time()-$ticket->LastUpdatedObj->Unix)/3600 >= $idleTime) {
$ticket->SetOwner($ownerNames[$newOwner]);
change priority?
$ticket->SetPriority($newPri);
}
}
The rt-users Archives
Be sure to check out the RT Wiki at http://wiki.bestpractical.com
matthew zeier, Sr. Network Engineer | “Nothing in life is to be feared.
InteleNet Communications, Inc. | It is only to be understood.”
(949) 784-7904 | - Marie Curie