[rt-users] Merge Scrip/Template

Jean-Sebastien Morisset jsmoriss at mvlan.net
Wed Mar 12 15:15:22 EDT 2008


On Tue, Mar 11, 2008 at 01:48:55PM +0000, Jean-Sebastien Morisset wrote:
> Hi everyone,
> 
> I'd like to create a Scrip/Template for a merged ticket. I was thinking
> of something like this for the Scrip:
> 
> Condition: User Defined
> Action: Notify Requestors and Ccs
> Template: Global template: Merged Ticket
> Custom condition:
>     return ( $self->TransactionObj->Type eq "Merge");
> 
> I'm not sure about the temnplate though... I'd like to reference the old
> and the new ticket numbers and subjects. Something like:
> 
>     Ticket # with a subject of "Bobo" has been merged into ticket # with
>     the subject "Something Else".
> 
> Any suggestions? :-)

Hi again everyone,

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?

Thanks,
js.
-- 
Jean-Sebastien Morisset, Sr. UNIX Administrator <jsmoriss at mvlan.net>



More information about the rt-users mailing list