[rt-users] Obtaining the first Attachment in a scrip (SOLVED)

Barry L. Kline blkline at attglobal.net
Thu Jun 22 16:49:54 EDT 2006


I know it's bad form to reply to yourself, but I stole some code from
http://wiki.bestpractical.com/index.cgi?AddLastCommentToMail,

changing it to the template:

RT-Attach-Message: yes


{
 my $resolution_comment;
 my $Transactions = $Ticket->Transactions;

 $Transactions->Limit( FIELD => 'Type', VALUE => 'Create' );

 my $CommentObj = $Transactions->First;
 if( $CommentObj && $CommentObj->id ) {
   $resolution_comment = $CommentObj->Content;
 }

 $resolution_comment;
}


and that (pardon the pun) was the ticket...

Further investigation on the wiki give me what may be an even easier
solution:

{ $Ticket->Transactions->First->Content; }

I didn't try it, though.



More information about the rt-users mailing list