[rt-users] Change ticket subject before first outgoing correspondence.

Michael Mol mikemol at gmail.com
Mon Aug 11 11:55:00 EDT 2014

On Mon, Aug 11, 2014 at 11:09 AM, Kevin Falcone
<falcone at bestpractical.com> wrote:
> On Thu, Aug 07, 2014 at 02:00:01PM -0400, Michael Mol wrote:
>> * Scrip re-ordering appears to be a feature of the 4.2 line of RT. I'm
>> running the vendor packages of RT 4 on Ubuntu 14.04.
> Nope. On RT 4.0, which is what I assume you mean by "vendor packages RT
> 4 on Ubuntu 14.04" you order scrips by their descriptions.  Typically
> this is done by literally numbering scrips that will run in the same
> condition.

Oh, that's good to know! I searched for at least an hour trying to
find that precise piece of information.

>> * I looked into upgrading, but I did not find any repositories making
>> backported packages available to 14.04. Pity; I selected 14.04 so I
>> wouldn't have to override the system as often.
> Debian has 4.2 packages available in testing, encouraging Ubuntu to
> take upgrades would be helpful.

I don't think it's likely for 14.04, which is an LTS. If 4.2 is in
Debian/testing, then it should show up in Ubuntu 14.10, at which point
a backports repository traditionally appears. So I'd guess that RT 4.2
will become available to Ubuntu 14.04 users in a few months.

>> * Even though I can't reorder scrips, I can create disable global
>> scrips and create local scrips with the same name, resulting in a
>> higher ID number (and theoretically later execution). However, this
>> has no apparent effect, regardless of whether I run the overriding
>> Notify scrips in the TransactionCreate or TransactionBatch stages.
> ID number has nothing to do with ordering.
>> I'm beginning to wonder if I need to set something beyond just the
>> ticket subject in my scrip. The scrip doing the work in question will
>> look familiar:
>> My last option appears to be to write a template that duplicates the
>> above logic in the template itself, which feels dirty, and looks
>> worse...
> You still haven't said what the Scrip is that isn't firing, both Alex
> and I assumed it was your Autoreply to Requestors because you were
> unclear.

Custom condition, matching the ticket subject and queue name. (The
latter being redundant, since it's a queue-specific scrip.)

The scrip *does* fire, as evidenced by the ticket's subject changing.
However, the AdminCC emails go out before the scrip fires. This is
true even though I have all of the Notify scrips in the
TransactionBatch stage, even though I have this scrip in the
TransactionCreate stage.

Here: (The queue name has been replaced with "somequeuename")

### Begin snippet for custom condition
return 0 unless $self->TransactionObj->Type eq "Create";
return 0 unless $self->TicketObj->QueueObj->Name eq "somequeuename";

return 1 if $self->TicketObj->Subject =~ "HP Insight Management Agents
Trap Alarm";

return 1 if $self->TicketObj->Subject =~ "HP Agent Trap Alert";

return 0;
### End snippet for custom condition

### Begin snippet for custom action preparation code
# Find the message from transactionobj->content
# Set the subject to the message by using ticketobj->SetSubject

my $body = $self->TransactionObj->Content;
my @lines = split(m/\n/, $body);
my $trapID = $lines[0];
my $message = $lines[2];

$self->TicketObj->SetSubject("$trapID -- $message");
### End snippet for custom action preparation code

### Begin snippet for custom action cleanup code
# No cleanup necessary; all the work was done in the prep stage.

return 1;
### End snippet for custom action cleanup code

> I've certainly modified a subject in a Scrip and then had an Autoreply
> fire with the correct subject by using a TransactionBatch scrip.
> Keep in mind, if you make all your Notify scrips TransactionBatch,
> they will no longer show up in the Preview Scrips box.
> I've seen your rewritten template, but a Notify scrip running in the
> transaction batch stage which has merely
> Subject: { $Ticket->Subject }
> should be more than sufficient, assuming it runs after your Subject
> modification scrip, preferably in a TransactionBatch scrip on the same
> Condition.

Interesting. Where does the subject come from, if not
$Ticket->Subject? (I guess I could just look at the source code for


More information about the rt-users mailing list