Moving a ticket on deletion

Hello. I am using RT 3.2.3. I would like to create a scrip
to move a ticket from one queue to another when the
ticket is deleted. So I created a custom scrip for the
originating queue as follows:

Description: MoveOnDelete
Condition: User Defined
Action: User Defined
Template: Global template: Status Change
Stage: TransactionCreate

Custom condition:
if ( $self->TicketObj->Status eq ‘Deleted’ ) {
return 1;
} else {
return 0;
}

Custom action preparation code:
my ($status,$msg) = $self->TicketObj->SetQueue(
‘Deleted’ );
unless ( $status ) {
die “Error: $msg”;
}
($status, $msg) = $self->TicketObj->SetStatus( ‘new’ );
unless ( $status ) {
die “Error: $msg”;
}
return 1;

Custom action cleanup code:
return 1;

While the ticket disappears from the originating queue, it
doesn’t show up in the ‘Deleted’ queue. I have tried
interchanging the preparation code with the cleanup code
(I guess I don’t understand the difference) but same
problem. Any pointers to what I am doing wrong? TIA.

Viren

At Friday 7/15/2005 03:27 PM, Viren Patel wrote:

Hello. I am using RT 3.2.3. I would like to create a scrip
to move a ticket from one queue to another when the
ticket is deleted. So I created a custom scrip for the
originating queue as follows:
Custom condition:
if ( $self->TicketObj->Status eq ‘Deleted’ ) {
return 1;
} else {
return 0;
}
Note that this condition will be true for any action taken on a deleted
ticket - maybe not a big deal because deleted tickets typically don’t have
anything done to them, but it might be safer to check the transaction to
emulate the “On Delete” condition. (look for trans type = ‘Status’,
NewValue = ‘deleted’ and OldValue != deleted’).

  ($status, $msg) = $self->TicketObj->SetStatus( 'new' );

So you’ve now got two status changes going on - maybe not a problem, but I
wonder if this is confusing RT?

While the ticket disappears from the originating queue, it
doesn’t show up in the ‘Deleted’ queue. I have tried
interchanging the preparation code with the cleanup code
(I guess I don’t understand the difference) but same
problem. Any pointers to what I am doing wrong? TIA.

Do you know what queue it does end up in? What status it gets? You should
be able to find the ticket in the database and check it’s Queue & Status
values. If you pull up the ticket in the web UI, does the history indicate
what happened?

Steve

At Friday 7/15/2005 03:27 PM, Viren Patel wrote:

Hello. I am using RT 3.2.3. I would like to create a scrip
to move a ticket from one queue to another when the
ticket is deleted. So I created a custom scrip for the
originating queue as follows:

One more question that occurred to me - as you are immediately changing the
status to new as soon as the ticket is deleted (as well as moving to
another queue), why not just change the queue for these tickets and not
bother about deleting?

Steve