Result after On queue change

Hi,

I try to build a scrip to avoid a queue change from a specific queue
(general (1)) if a Cf (Text1) isn’t set on a rt3.8 box.

In principal it work as a global scrip, but the result field didn’t say
the truth. :wink:

After the not possible queue change the ticket is in the old queue, but
results tells me:

Ticket 30: Queue changed from General to TQ-1

Any ideas to fix this?

Cheers,
Bj�rn

P.S. Here is my global scrip. On queue level (general) it doesn’t work
for me.

Description: Queue Change only if Text1 is set
Condition: On Queue Change
Action: User Defined
Template: Global template Blank
Stage: TransactionCreate

Custom action preparation code:

return 1;
Custom action cleanup code:

my $OV =
$self->TransactionObj->OldValue;
$RT::Logger->crit("The old value is: ".$OV);
if ($OV != 1)
{
return 0;
}
if (!$self->TicketObj->FirstCustomFieldValue(“Text1”))
{
$self->TicketObj->SetQueue($OV);
}
return 1;

In pricipal

I try to build a scrip to avoid a queue change from a specific queue
(general (1)) if a Cf (Text1) isn’t set on a rt3.8 box.

In principal it work as a global scrip, but the result field didn’t say
the truth. :wink:

After the not possible queue change the ticket is in the old queue, but
results tells me:

Ticket 30: Queue changed from General to TQ-1

Any ideas to fix this?

Unfortunately, the Scrip runs after the queue has been changed (it’s
triggered by the transaction of the change), and Scrips can’t hand data
back to the Messages in the UI.

You’ll need to do this with a callback, probably BeforeUpdate in
Update.html. That callback lets you set a $skip_update boolean as
well as push a message onto @results. It will also prevent the queue
change, so it won’t be a change and a change back.

-kevin

Hi Kevin,

So it’s clear that we have to use our not-change-queue-extension for
that. :wink:

My hope was that we can do it in a scrip.

Thanks a lot for your advice.

Have a great day.

Cheers,
Bj�rnOn 13.08.12 16:37, Kevin Falcone wrote:

On Mon, Aug 13, 2012 at 01:54:33PM +0200, Bj�rn Schulz wrote:

I try to build a scrip to avoid a queue change from a specific queue
(general (1)) if a Cf (Text1) isn’t set on a rt3.8 box.

In principal it work as a global scrip, but the result field didn’t say
the truth. :wink:

After the not possible queue change the ticket is in the old queue, but
results tells me:

Ticket 30: Queue changed from General to TQ-1

Any ideas to fix this?

Unfortunately, the Scrip runs after the queue has been changed (it’s
triggered by the transaction of the change), and Scrips can’t hand data
back to the Messages in the UI.

You’ll need to do this with a callback, probably BeforeUpdate in
Update.html. That callback lets you set a $skip_update boolean as
well as push a message onto @results. It will also prevent the queue
change, so it won’t be a change and a change back.

-kevin

P.S. Here is my global scrip. On queue level (general) it doesn’t work
for me.

Description: Queue Change only if Text1 is set
Condition: On Queue Change
Action: User Defined
Template: Global template Blank
Stage: TransactionCreate


Custom action preparation code:

return 1;

Custom action cleanup code:

my $OV =
$self->TransactionObj->OldValue;
$RT::Logger->crit("The old value is: ".$OV);
if ($OV != 1)
{
return 0;
}
if (!$self->TicketObj->FirstCustomFieldValue(“Text1”))
{
$self->TicketObj->SetQueue($OV);
}
return 1;

In pricipal