Change Queue Custom Scrip - moves back to original queueafter webui reloads

I’ll be very interested in the answers or the solution you get …
Its all down to the order the update page (Update.html) or (ModifyAll.html) excute things …
In your case: it picks up the change of status and excute all scrips related to this including moving to a different queue=>Q2.
then it goes through the Queue name and beacuse when you loaded update.html the ticket was in Q1, hence its that value loaded into %ARGS->{Queue}
and so it assume you need a change of queue back to Q1 …
I have very similar problem (regarding owners) and I am interested of how this can be resolved.

Regards;

Roy----- Original Message -----
From: David
To: rt-users@lists.bestpractical.com
Sent: Wednesday, October 26, 2005 7:05 AM
Subject: [rt-users] Change Queue Custom Scrip - moves back to original queueafter webui reloads

Greetings Everyone,

I have created a custom status that I am trying to set a condition on to move tickets from one queue to another. The code that I have used is…

Condition: On Status Change
Action: User Defined

Custom Condition: return 1;
Custom action preparation code: return 1;
Custom action cleanup code:
my $TargetQueueName = ‘Queue2’;
my $NewStatus = ‘PassToQueue2’;
if (($self->TicketObj->Status eq “$NewStatus”) && ($self->TicketObj->QueueObj->Name ne “$TargetQueueName”)) {
my $TicketObj = $self->TicketObj;
my $Id = $TicketObj->Id;
my $Status = $TicketObj->Status;
my $QueueName = $TicketObj->QueueObj->Name;

  if ($Status ne $NewStatus) {
      my ($tstatus, $tmsg) = $TicketObj->SetStatus("$NewStatus");
      $RT::Logger->info("Changing status of ticket #". $Id ." to ". $NewStatus);
      unless ($tstatus) {
          die "Error: $tmsg";
      }
  }
  if ($QueueName ne $TargetQueueName) {
      my ($qstatus, $qmsg) = $TicketObj->SetQueue("$TargetQueueName");
      $RT::Logger->info("Moving Ticket #". $Id ." to ". $TargetQueueName ." Queue.");
      unless ($qstatus) {
          die "Error: $qmsg";
      }
  }

}
return 1;

The ticket moves queues but when the web ui reloads it resets it back to the old queue.

I appreciate all feedback …

Thanks.
David.

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

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Buy your copy of our new book, RT Essentials, today!

Download a free sample chapter from http://rtbook.bestpractical.com