Scrip condition input request

I have a global scrip which applies to all of our queues. It basically forces
the status of a ticket to ‘new’ when it is moved to a different queue. For the
most part this works well. However, I have a group which has “ownership” of two
queues. One is our triage queue and the other is a queue for operational support.

Sometimes, a person will take ownership of a ticket prior to moving it from
triage. If this happens, it makes setting the status back to new moot since the
original owner will likely retain ownership and continue working on the ticket.

With that in mind I’m trying to devise a condition which will check if the new
queue is the ops support queue and if the current owner is a: not Nobody and b:
has the right to own a ticket in the ops support queue. Currently, the
condition for this scrip is ‘On Queue Change’. In order to enact these other
conditions, will I have to use a custom condition and incorporate the
functionality of ‘On Queue Change’ or can I add the conditions to the Custom
action preparation code field and use it as an additional check?

Or, can I simply use an ‘unless’ conditional in the Custom action cleanup code
field?

Keep up with me and what I’m up to: http://theillien.blogspot.com

Matt,

You can either use a custom condition or use a conditional in your cleanup code.

-ToddOn 11/26/07, Mathew Snyder theillien@yahoo.com wrote:

I have a global scrip which applies to all of our queues. It basically forces
the status of a ticket to ‘new’ when it is moved to a different queue. For the
most part this works well. However, I have a group which has “ownership” of two
queues. One is our triage queue and the other is a queue for operational support.

Sometimes, a person will take ownership of a ticket prior to moving it from
triage. If this happens, it makes setting the status back to new moot since the
original owner will likely retain ownership and continue working on the ticket.

With that in mind I’m trying to devise a condition which will check if the new
queue is the ops support queue and if the current owner is a: not Nobody and b:
has the right to own a ticket in the ops support queue. Currently, the
condition for this scrip is ‘On Queue Change’. In order to enact these other
conditions, will I have to use a custom condition and incorporate the
functionality of ‘On Queue Change’ or can I add the conditions to the Custom
action preparation code field and use it as an additional check?

Or, can I simply use an ‘unless’ conditional in the Custom action cleanup code
field?


Keep up with me and what I’m up to: http://theillien.blogspot.com


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

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we’ll take
up to 20 percent off the price. This sale won’t last long, so get in touch today.
Email us at sales@bestpractical.com or call us at +1 617 812 0745.

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

This is all I could think to come up with:

if ($self->TransactionObj->Type eq “Set” && $self->TransactionObj->Field eq
"Queue") {
if ($self->TransactionObj->NewValue eq “TechOps” && $self->TicketObj->Owner !=
10) {
return 0;
}else{
$self->TicketObj->SetStatus(‘new’);
return 1;
}
}

But that seems a bit excessive since the condition is already telling it to
check that the queue is changing. If I eliminate the first if condition and
leave just the condition checking the new value will it work since it already
knows what the initial condition is?

Keep up with me and what I’m up to: http://theillien.blogspot.com

Todd Chapman wrote:

You probably could eliminate the first condition but I doubt it’s very
expensive to check it again. Also it doesn’t hurt to have the
safeguard if someone accidentally changes the Condition.On 11/26/07, Mathew Snyder theillien@yahoo.com wrote:

This is all I could think to come up with:

if ($self->TransactionObj->Type eq “Set” && $self->TransactionObj->Field eq
"Queue") {
if ($self->TransactionObj->NewValue eq “TechOps” && $self->TicketObj->Owner !=
10) {
return 0;
}else{
$self->TicketObj->SetStatus(‘new’);
return 1;
}
}

But that seems a bit excessive since the condition is already telling it to
check that the queue is changing. If I eliminate the first if condition and
leave just the condition checking the new value will it work since it already
knows what the initial condition is?

Keep up with me and what I’m up to: http://theillien.blogspot.com

Todd Chapman wrote:

Matt,

You can either use a custom condition or use a conditional in your cleanup code.

-Todd

On 11/26/07, Mathew Snyder theillien@yahoo.com wrote:

I have a global scrip which applies to all of our queues. It basically forces
the status of a ticket to ‘new’ when it is moved to a different queue. For the
most part this works well. However, I have a group which has “ownership” of two
queues. One is our triage queue and the other is a queue for operational support.

Sometimes, a person will take ownership of a ticket prior to moving it from
triage. If this happens, it makes setting the status back to new moot since the
original owner will likely retain ownership and continue working on the ticket.

With that in mind I’m trying to devise a condition which will check if the new
queue is the ops support queue and if the current owner is a: not Nobody and b:
has the right to own a ticket in the ops support queue. Currently, the
condition for this scrip is ‘On Queue Change’. In order to enact these other
conditions, will I have to use a custom condition and incorporate the
functionality of ‘On Queue Change’ or can I add the conditions to the Custom
action preparation code field and use it as an additional check?

Or, can I simply use an ‘unless’ conditional in the Custom action cleanup code
field?


Keep up with me and what I’m up to: http://theillien.blogspot.com


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

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we’ll take
up to 20 percent off the price. This sale won’t last long, so get in touch today.
Email us at sales@bestpractical.com or call us at +1 617 812 0745.

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

I tried both ways. Each ends up resetting the status to new.

Keep up with me and what I’m up to: http://theillien.blogspot.com

Todd Chapman wrote:

I haven’t been able to sort this out. When I move a ticket from our triage
queue to our TechOps queue it is still reset to new. Anyone have any thoughts
on how to get this working?

Condition: On Queue Change
Action: User Defined
Template: Global template: Blank
Stage: TransactionCreate

Custom condition:

Custom action preparation code:
return 1;

Custom action cleanup code:
if ($self->TransactionObj->Type eq “Set” && $self->TransactionObj->Field eq
"Queue") {
if ($self->TransactionObj->NewValue eq “TechOps” || $self->TicketObj->Owner !=
10) {
return 0;
}else{
$self->TicketObj->SetStatus(‘new’);
return 1;
}
}

Keep up with me and what I’m up to: http://theillien.blogspot.com

Thanks. I removed the first ‘if’ as suggested by both you and Todd (this didn’t
seem to work before which is why it was still in there after Todd’s suggestion).
I’ve tested it on our development server and it seems to do what I think it
should. However, I have admin rights so I need to verify with someone who’s
rights are limited that it is actually working.

I’ve also removed the criteria that the owner not be Nobody as it seems moot for
our needs. The NewStatus method makes use of either the queue name or id.

Thanks again.

Keep up with me and what I’m up to: http://theillien.blogspot.com

Roy El-Hames wrote:

Matthew;

Why do you need the first if, as your condition is Queue change which
should compensate for :

if ($self->TransactionObj->Type eq “Set” && $self->TransactionObj->Field eq “Queue”) {

Also

$self->TransactionObj->NewValue eq “TechOps”

I am guessing this should be the Queue Id and not Name, ie number not label.

Regards;
Roy

Mathew Snyder wrote:

Well, I thought I had solved the problem. However, had noticed a potential
problem with the way I had it set up:

if ($self->TransactionObj->NewValue eq “TechOps”) {
return 0;
}else{
$self->TicketObj->SetStatus(‘new’);
return 1;
}

I need the status set to new for anything that isn’t coming from our triage
queue. Right now it looks as if it will avoid being set to new regardless of
which queue it comes from. This doesn’t work with our policies.

I thought that if I modify it to include the old value of the triage queue it
would work. But instead, it sets it to new again.

if ($self->TransactionObj->OldValue eq “TriageQueue” &&
$self->TransactionObj->NewValue eq “TechOps”) {
return 0;
}else{
$self->TicketObj->SetStatus(‘new’);
return 1;
}

I then reset the code to the former value (without the OldValue condition) and
now it sets it to new again. I’m so confrused :frowning:

Keep up with me and what I’m up to: http://theillien.blogspot.com

Mathew Snyder wrote:

So Mathew I am guessing you want tickets moved to the TechOps queue to
change to new if these were moved from TriageQueue , then I would
suggest you do a queue script (ie not global) in the TechOps queue ,
with the On Queue change condition and User defined Action, return 1;
for prep code and action clean up as follows:
if ($self->TransactionObj->OldValue == 18) {
$self->TicketObj->SetStatus(‘new’);
return 1;
} else {
return undef;
}

Change the 18 to the value of the queue id for your TriageQueue ; I
tried using Queue name did not work.

Good luck;
Roy

Mathew Snyder wrote:

I want the opposite actually. I want the status set to new for every ticket
moving to every queue except tickets being moved from TriageQueue to TechOps.

Keep up with me and what I’m up to: http://theillien.blogspot.com

Roy El-Hames wrote:

Thanks for the help. I’ve sorted it out but switched things up a little:

if ($self->TransactionObj->OldValue == 1 && $self->TransactionObj->NewValue == 15) {
return undef;
}else{
$self->TicketObj->SetStatus(‘new’);
return 1;
}

Keep up with me and what I’m up to: http://theillien.blogspot.com

Roy El-Hames wrote: