[rt-users] Using RT::Template with MIMEObj to create a new ticket using ->Create()

Landon Stewart lstewart at iweb.com
Mon Sep 16 16:04:35 EDT 2013


On 14 September 2013 13:19, Ruslan Zakirov <ruz at bestpractical.com> wrote:

> I don't understand your problem here. You have an incident and want to
> create an investigation with a scrip using a template. Templates are used
> here so you don't have to change code every time you to change a word or
> add a new particular text for such investigations.
>
> Here what you do:
>
> 1) scrip is executed when something happens with an Incident, so
> $self->TicketObj is an Incident
> 2) You take Incident's props and use them to generate template name
> 3) You load template and Parse it, providing as much context as possible
> to the template
>
> Here is fun part - RT doesn't care what you pass into template. You can
> probably even skip all arguments and if your template is capable to work
> without arguments then it will work.
>
> 4) Template can have code embedded, so it can use provided context (in
> your case Incident) to fill in dynamic details.
> 5) Template should not change anything, but format some result
> 6) After parsing you get MIMEObj based on existing Incident, IRs, watchers
> of these tickets, CFs, transactions...
> 7) You complete this MIMEObj with additional data and these actions can be
> controlled from templates, for example whether IRs's replies should be
> attached to the Investigation or not can be controlled by 'RTIR-Attach-IRs:
> yes' header (this is exactly what RT does in notification scrips)
> 8) Once MIMEObj is complete you create your investigation ticket
>

Thank you very much for this breakdown of the process.  I've re-worked
things and I'm relying on the Scrip for the Investigations queue that
applies the template to apply it now.  I was trying to do it before hand
thinking that the Scrips would not fire when creating the ticket using a
Scrip/Action module.  Nevertheless it does and a lot of things were cleaned
up and made much easier than I thought they'd be.

Thanks again

-- 
Landon Stewart :: lstewart at iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130916/ecd451ef/attachment.htm>


More information about the rt-users mailing list