[rt-users] From a template, how do I get a handle to a ticket attachment?
Ole Craig
ocraig at stillsecure.com
Thu Sep 14 15:42:34 EDT 2006
On Thu, 2006-09-14 at 09:29 -0400, 'twas brillig and Stephen Turner
scrobe:
> 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
> Stephen -
Thanks! I could have sworn I'd tried that and got an error, but
apparently not; maybe I fatfingered something last time.
Is there a wikipage or other resource that lists what objects and
structures are inherently available within scrips and templates? I have
the Essentials book, but it's not much help at that level.
Anyhow, my template is now working:
To: { my $msgattr = $Transaction->Message->First;
my $customername = $msgattr->GetHeader('X-MY-HEADERVAL');
my $pageraddr = $customername . 'pager at nagios.example.com';
$RT::Logger->warning("using \'$pageraddr\' as pager address;");
return $pageraddr;}
RT-Attach-Message: yes
Pager alert from $customername!
Subject: {$Transaction->Subject || $Ticket->Subject || "(No
subject given)"}
Requestors: {$Ticket->RequestorAddresses}
{$Transaction->Content()}
Now I can move on to figuring out how to get Nagios to add a comment to
the ticket when it receives an ACK from the pager.
--
/Ole Craig
Security Engineer
Team lead, customer support
303-381-3802 (main support hotline)
303-381-3824 (my direct line)
303-381-3801 (fax)
www.stillsecure.com
. . .
More information about the rt-users
mailing list