[rt-users] Ticket history sent by email

Michael Markstaller mm at elabnet.de
Thu Aug 14 10:31:33 EDT 2003


I searched for the same some weeks ago and had to build this together from several sniplets on the archive which either did only similar things or didn't work (doubled last reply on resolve ticket) so I'll post it completely.. the template below sends out only replys, no comments !

- create a Template with the following content (I've deleted out some of my specific text)

###########################
### cut end of template ###
###########################
Subject: Resolved: {$Ticket->Subject}

Dear customer,

your issue regarding

        "{$Ticket->Subject()}",

has been resolved in our ticket system. See below for history of this ticket.

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

regards

{$Ticket->OwnerObj->RealName}
your-company-fooprint


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

{$Ticket->Transactions->First->Content()}

----------------------------------------------------------------
   Complete Ticket History
----------------------------------------------------------------

{
  my $resolved_transaction;
  my $resolved_message = "";
  my $last_content;
  my $Transactions = $Ticket->Transactions;
  $Transactions->OrderBy;
  $Transactions->GotoFirstItem;
  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;
    $attachments->GotoFirstItem;

    while (my $message = $attachments->Next) {
      next unless $message->ContentType =~
               m!^(text/plain|message|text$)!i;

      my $content = $message->Content;
      if ($last_content eq $content) {
               $content = undef; }
      next unless length $content;
      $last_content = $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 ." (".$rtname.")";
      $resolved_message .= "\n";
      $resolved_message .= "Time: ";
      $resolved_message .= $message->CreatedObj->AsString;
      $resolved_message .= "\n";
      $resolved_message .= "\n";
      $resolved_message .= "$content\n";
      $resolved_message .= "------------------------------------------------\n";
    }
  }
}
  $resolved_message;
}

-------------------------------------------------------------------------
Common Information
-------------------------------------------------------------------------

There is no need to reply to this message unless you want to RE-OPEN your 
ticket with ID [{$rtname} #{$Ticket->id()}]. 

If you want to simply add a COMMENT to this ticket whithout re-opening the ticket, click below:
mailto:rt-comment at yourdomain.com?subject=[{$rtname}%20#{$Ticket->id()}]&body=%20


Please note:
- ALWAYS include the string [{$rtname} #{$Ticket->id}] in the subject line of all future correspondence about this issue.
- Do NOT attach or include the content of previous emails already sent to you by rt.


###########################
### cut end of template ###
###########################

- create a Scrip on the Queue or globally: 
Condition: On resolve
Action: Notify Requestors and CCs <or whatever you want>
Template: <The above template>


works for me, one remaining problem is that when I do a reply and set the ticket to "resolved" the user gets two mails, one reply and the the "resolved" message.
as the status "resolved" is set after the reply-template is processed I've seen no easy way to prevent this..


regards

Michael

-----Original Message-----
From: Vassilios Ioannidis [mailto:Vassilios.Ioannidis at isrec.unil.ch]
Sent: Thursday, August 14, 2003 2:44 PM
To: rt-users at lists.fsck.com
Cc: Vassilios Ioannidis
Subject: [rt-users] Ticket history sent by email


Hello,


I am testing RT 3.0.4 and I would like to know if there is an easy way
to have a ticket history sent by email when a ticket is resolved ?
(something like OnResolve Notify AdminCC, Template ("ticket history")
or any other solution ?)

Thanks for helping,

Vassilios
--------------------------------------------------------------
Vassilios Ioannidis, PhD



More information about the rt-users mailing list