[rt-users] Having the last transaction (or the full ticket) in emails on queue or owner changes

L B bertignac at gmail.com
Thu Jun 23 08:54:32 EDT 2011


Thanks Kevin, I searched the wiki but didn't find this page.

Here is what I did for my problem. It only print the last
correspondance/comment. This is sent in my case to the owner for an
owner  change, and to the adminccs of the queue for a queue change.

To put in the template used for owner change or queue change:

{
my $txns = $Ticket->Transactions;
$txns->Limit(
FIELD    => 'Type',
VALUE    => $_,
) for qw(Create Correspond Comment);

my $last_content;
my $AttachmentObjects = $txns->Last()->Attachments;
while( my $at = $AttachmentObjects->Next()){
        next if $at->ContentType !~ m!^(text/html|text/plain|message|text$)!i;
        $last_content = $at->Content;
}
$last_content =~ s/<(([^ >]|\n)*)>//g;  # strip HTML tags from text/html
$last_content;
}

Looks ok so far...

-- 
L.B.



More information about the rt-users mailing list