[rt-users] From a template, how do I get a handle to a ticket attachment?

Stephen Turner sturner at MIT.EDU
Thu Sep 14 09:29:51 EDT 2006


At Wednesday 9/13/2006 06:42 PM, Ole Craig wrote:
>(3.6.0/mysql4/CentOS)
>
> >From a template, how can I get at the value of a specific header in the
>first email message in a ticket? I know how to get it in a scrip:
>
>my $trans = $self->TransactionObj;
>my $msgattr = $trans->Message->First;
>my $headerval = $msgattr->GetHeader('X-MY-HEADER');
>
>...but when I try to do that from template context I get this:
>
>[Tue Sep 12 11:33:25 2006] [error]: Template parsing error: Can't call
>method "TransactionObj" on an undefined value at template line 1.

Ole,

You get at objects a bit differently in templates - available to you 
is $Ticket, $Transaction etc. So you can replace  the first 2 lines 
of your code above with:

my $msgattr = $Transaction->Message->First;

The global templates that come with RT are a good reference.

Good luck,
Steve 




More information about the rt-users mailing list