Merge Scrip/Template

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? :slight_smile:

Thanks,
js.
Jean-Sebastien Morisset, Sr. UNIX Administrator jsmoriss@mvlan.net

No ideas? Anyone?

js.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? :slight_smile:

Jean-Sebastien Morisset, Sr. UNIX Administrator jsmoriss@mvlan.net

[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—

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. :slight_smile:

js.
Jean-Sebastien Morisset, Sr. UNIX Administrator jsmoriss@mvlan.net

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? :slight_smile:

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:

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@mvlan.net