[rt-users] Working "Resolved - complete history" Template

Seth Cohn, EFN General Manager gm at efn.org
Tue Jan 7 16:28:47 EST 2003

I tried a few of the existing "Resolved" Templates I found in the
archives, and had some trouble getting them to work, but I persevered and
finally made something I liked that had additional features.  In the
process, I learned much more about DBI::SearchBuilder and how templates

I'm still not sure I'll use this as a 'resolved' template for sending to
Requestor on close of tickets, but it would be useful for any sort of
reporting needed on status, or other 'what's the history?' need.
Imagine a 'ifPriorityExceeds' calling this to notify some else of the
ticket and the history behind it.

Only correspondence is processed (easy to change)

Items with no subject are given the Subject of the Ticket itself,
rather than no subject listed.

and no emails are given, only Real Names. (again, fairly easy to add)

Overall, I like it.  Shows me the power of RT templates.  For webusers,
this isn't really needed, but for email users, this could be very nice
indeed (imagine a 'send history' command)

Subject: Ticket Resolved: {$Ticket->Subject}


Your issue regarding


has been resolved in our ticket system.

If you have any further questions or concerns, please reply to this
message to reopen the ticket.  Otherwise, no need to reply.

the staff

--- Your initial request was -----------------------------------


--- Additional activity ----------------------------------------

  my $resolved_transaction;
  my $resolved_message = "";
  my $Transactions = $Ticket->Transactions;
  while (my $Transaction = $Transactions->Next) {
    if ($Transaction->Type eq 'Correspond') {
      $resolved_transaction = $Transaction;
       } elsif (!$Transactions->IsLast) {      
      $resolved_transaction = undef;

  if ($resolved_transaction) {
    my $attachments = $resolved_transaction->Attachments;

    while (my $message = $attachments->Next) {
      next unless $message->ContentType =~

      my $content = $message->Content;
      next unless length $content;

      my $subject = ($message->Subject || $Ticket->Subject);

      my $wrapper = Text::Wrapper->new(columns=>70);
      $content = $wrapper->wrap($content);

      $resolved_message .= "Subject: ";
      $resolved_message .= $subject;
      $resolved_message .= "\n";
      $resolved_message .= "From: ";
      $resolved_message .= $message->CreatorObj->RealName;
      $resolved_message .= "\n";
      $resolved_message .= "Time: ";
      $resolved_message .= $message->CreatedObj->AsString;
      $resolved_message .= "\n";
      $resolved_message .= "\n";
      $resolved_message .= "$content\n";
      $resolved_message .= "--------------------------\n";


## Seth Cohn, General Manager of Eugene Free Community Network gm at efn.org
## Businesses planned for service are apt to succeed;  Phone 541-484-9637
## Businesses planned for profit are apt to fail. - N. Butler

More information about the rt-users mailing list