Scrip for replying to a resolved ticket, scrip results

Hi all, two questions that I haven’t been able to find answers to after
a few hours of searching and reading through code:

(For reference I use RT 3.8.4 right now)

  1. I’d like to set up a scrip that will correspond with a template when
    someone replies to a ticket that has been resolved. I have tried a
    number of different things to try and only send the reply to the person
    who sent the correspondence, but I gave up and decided I’d be happy if
    it would just autoreply to all requestors and CCs with my template when
    someone replies to it and it’s resolved. So the most recent scrip I
    have tried is the simplest, and doesn’t seem to do anything. Can anyone
    tell me what I’m doing wrong?

Condition: User Defined
Action: Autoreply to Requestors and Ccs
Template: Global template: Autoreply to Resolved
Stage: TransactionCreate

Custom Condition:
return 0 unless ($self->TransactionObj->Type eq “Correspond” &&
$self->TicketObj->Status eq “Resolved”);
return 1;

  1. We have a number of custom scrips in our RT installation, many of
    which perform transactions themselves - for example, when a ticket’s
    queue is changed from A to B, make sure X and Y custom fields are set,
    if they aren’t, put the ticket back in A. The actual line to move the
    ticket back is

my ($retcode, $msg) = $self->TicketObj->SetQueue($original_queue);

The problem is, when you go to actually move the ticket to B, and it
gets moved back to A by the scrip, the “Results” section at the top of
the page only displays that it moved the ticket from A to B, and without
looking at the queue you’d have no idea that it was automatically moved
back for you.

So is it possible to either

  • Rewrite my line of code above to record the standard “Ticket moved
    from A to B” message in the Results section, or
  • (preferred) Inject arbitrary text in to this Results box so I can add
    my own explanation to the user as to what happened and why?

Thanks for your time, let me know if I can provide any more information
on any of this.

Evan

This email (including any attachments) is for its intended-recipient’s
use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this message
from your system. For further information and disclaimers that apply to
this email, see [http://www.viacom.com/termsofuse/Pages/default.aspx].

Hi Evan,On 4/21/2010 8:02 AM, Lucchesi Leon, Evan wrote:

Hi all, two questions that I haven’t been able to find answers to after
a few hours of searching and reading through code:

(For reference I use RT 3.8.4 right now)

  1. I’d like to set up a scrip that will correspond with a template when
    someone replies to a ticket that has been resolved. I have tried a
    number of different things to try and only send the reply to the person
    who sent the correspondence, but I gave up and decided I’d be happy if
    it would just autoreply to all requestors and CCs with my template when
    someone replies to it and it’s resolved. So the most recent scrip I have
    tried is the simplest, and doesn’t seem to do anything. Can anyone tell
    me what I’m doing wrong?

Condition: User Defined
Action: Autoreply to Requestors and Ccs
Template: Global template: Autoreply to Resolved
Stage: TransactionCreate

Custom Condition:
return 0 unless ($self->TransactionObj->Type eq “Correspond” &&
$self->TicketObj->Status eq “Resolved”);
return 1;

I don’t know whether it matters, but I always use lowercase for
TicketObj->Status because that’s how it’s stored in the database (in
3.6.3). I have a similar scrip (but with additional conditions) and it
works using “Correspond” and “resolved”.

If changing the case doesn’t work, putting $RT::Logger->debug(“Myscrip
Status=” . $self->TicketObj->Status . “, Type=” .
$self->TransactionObj->Type) as your first line might help you figure
out what is going on.

Gene

Hi Evan;

I think Gene answered 1;
For 2 I have something similar, but what I do on failure is to submit a
comment to the ticket with an explanation why the queue move have failed.
As far as I know the text in the Results section @results is
generated/built while processing the actions , and cannot be injected into.

Regards;
Roy

Lucchesi Leon, Evan wrote:

Yes, Gene’s answer solved #1 (Thanks Gene!)

I had tried a number of different combinations of values but didn’t hit
on the right one. Thanks for the tip about logging the parameters too,
usually I do that sort of debugging by adding a comment to a ticket in
my test environment but this may work better for me.

As for #2, we already do submit a comment to the ticket explaining what
happened, but for various procedural reasons it was requested that we
display the action more prominently to people using the web interface.
I’ll play around and see if I can add anything to @results, but if
anyone else has any suggestions that would be appreciated.

EvanFrom: Raed El-Hames [mailto:rfh@vialtus.com]
Sent: Wednesday, April 21, 2010 12:04 PM
To: Lucchesi Leon, Evan
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Scrip for replying to a resolved ticket, scrip
results

Hi Evan;

I think Gene answered 1;
For 2 I have something similar, but what I do on failure is to submit a
comment to the ticket with an explanation why the queue move have
failed.
As far as I know the text in the Results section @results is
generated/built while processing the actions , and cannot be injected
into.

Regards;
Roy

Lucchesi Leon, Evan wrote:

Hi all, two questions that I haven’t been able to find answers to
after a few hours of searching and reading through code:

(For reference I use RT 3.8.4 right now)

  1. I’d like to set up a scrip that will correspond with a template
    when someone replies to a ticket that has been resolved. I have tried

a number of different things to try and only send the reply to the
person who sent the correspondence, but I gave up and decided I’d be
happy if it would just autoreply to all requestors and CCs with my
template when someone replies to it and it’s resolved. So the most
recent scrip I have tried is the simplest, and doesn’t seem to do
anything. Can anyone tell me what I’m doing wrong?

Condition: User Defined
Action: Autoreply to Requestors and Ccs
Template: Global template: Autoreply to Resolved
Stage: TransactionCreate

Custom Condition:
return 0 unless ($self->TransactionObj->Type eq “Correspond” &&
$self->TicketObj->Status eq “Resolved”); return 1;

  1. We have a number of custom scrips in our RT installation, many of
    which perform transactions themselves - for example, when a ticket’s
    queue is changed from A to B, make sure X and Y custom fields are set,

if they aren’t, put the ticket back in A. The actual line to move the

ticket back is

my ($retcode, $msg) = $self->TicketObj->SetQueue($original_queue);

The problem is, when you go to actually move the ticket to B, and it
gets moved back to A by the scrip, the “Results” section at the top of

the page only displays that it moved the ticket from A to B, and
without looking at the queue you’d have no idea that it was
automatically moved back for you.

So is it possible to either

  • Rewrite my line of code above to record the standard “Ticket moved
    from A to B” message in the Results section, or
  • (preferred) Inject arbitrary text in to this Results box so I can
    add my own explanation to the user as to what happened and why?

Thanks for your time, let me know if I can provide any more
information on any of this.

Evan

This email (including any attachments) is for its intended-recipient’s

use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this
message from your system. For further information and disclaimers
that apply to this email, see
[http://www.viacom.com/termsofuse/Pages/default.aspx].

This email (including any attachments) is for its intended-recipient’s
use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this message
from your system. For further information and disclaimers that apply to
this email, see [http://www.viacom.com/termsofuse/Pages/default.aspx].