[rt-users] Merge Scrip/Template
Jean-Sebastien Morisset
jsmoriss at mvlan.net
Wed Mar 12 15:38:09 EDT 2008
On Wed, Mar 12, 2008 at 07:15:22PM +0000, Jean-Sebastien Morisset wrote:
>
[snip!]
> Well, using some examples from the Wiki, I got _most_ of this
> scrip/template working...
>
> Scrip:
> Custom condition:
> my $trans = $self->TransactionObj;
> return 0 unless ($trans->Type =~ /^AddLink$/i);
> return 0 unless ($trans->Field =~ /^MergedInto$/i);
> return 0 if ($trans->ObjectId == $self->TicketObj->Id);
> return 1;
>
> The last Id to Id comparison is not in the Wiki. This scrip is actually
> called twice by RT, once at the beginning, when we have the info of both
> tickets, and once at the end, where both the Transaction info and Ticket
> info match. Since I only want to run it once, and need access to both
> ticket infos, I added this test to skip the second run.
>
> Template:
> Subject: Ticket #{$Transaction->ObjectId} Merged into Ticket #{$Ticket->id}
>
> Ticket #{$Transaction->ObjectId} regarding "{$Transaction->Subject}" has been merged into ticket #{$Ticket->id} in the {$Ticket->QueueObj->Name()} queue.
>
> -> Ticket URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
>
> And here-in lies my problem. I'd like to include the subject from the
> old ticket, but Transaction->Subject just gives me a blank. Can anyone
> offer a suggestion on how to get the old ticket subject?
I guess I should have waited a little longer before sending this e-mail,
because I later figured the subject probably wasn't available, but
still, I had the old ticket Id to work from:
---BEGIN---
Subject: Ticket #{$Transaction->ObjectId} Merged into Ticket #{$Ticket->id}
Ticket #{$Transaction->ObjectId} regarding "{
my $oldTicket = RT::Ticket->new($RT::SystemUser);
$oldTicket->LoadById($Transaction->ObjectId);
$oldTicket->Subject();
}" has been merged into ticket #{$Ticket->id} in the {$Ticket->QueueObj->Name()} queue.
-> Ticket URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
---END---
Not bad, if I do say so myself. :-)
js.
--
Jean-Sebastien Morisset, Sr. UNIX Administrator <jsmoriss at mvlan.net>
More information about the rt-users
mailing list