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

Ruslan Zakirov ruz at bestpractical.com
Sat Sep 14 03:19:06 EDT 2013

On Fri, Sep 13, 2013 at 9:16 PM, Landon Stewart <lstewart at iweb.com> wrote:

> This was originally posted to the RTIR list but I'm x-posting it here
> because it's not specific to RTIR and I'm still having difficulties.
> I've been unable to figure out how to call an action module from another
> action module but instead I've been working on an action module that
> basically:
> - gets called on an Incident (and uses the create and correspond
> transactions to open a new Investigations ticket)
> - attaches the Incident Reports linked to that Incident to the
> Investigation…
> I have it creating a ticket although I haven't filled in much of the
> CustomFields I'll need to I cannot get it to use a template for some
> reason.
> Specifically the LoadQueueTemplate() and Parse() a bit of a mystery to me.
> Example:
>     $templateObj->LoadQueueTemplate( Queue => "Investigations", Name =>
> $classification." (en)" );
>     my($ret, $msg) = $templateObj->Parse( TicketObj => $new_ticket,
> TransactionObj => $self->TransactionObj );
> I am building a MIME::Entity above this called $MIMEObj including all the
> attachments etc but I don't understand how to get Parse() to to "do
> something" to the MIMEObj to get the MIME::Entity->build( Data => … ) to
> use the template.  Also the attachments are coming out in-line in the
> message instead of attachments but that's probably because the
> "RT-Attach-Message: yes" header is in the template that's not being used if
> I'm understanding the use of that header correctly.

You should go other way around. After calling $template->Parse you call
$template->MIMEObj and get MIME::Entity representing result of the
template. You then can update this entity with attachments, more headers
and so on.

RT-Attach-Message: yes header is checked by notification scrip, so it
should be in notification template, not in template which you use to
generate content.

> A more full representation of the code is here:
> http://pastebin.com/QF2tbZqH
> Thanks to anyone who has an idea of what I'm missing or doing wrong here
> and might have some ideas for me.
> --
> 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
> --
> RT Training in New York, October 8th and 9th:
> http://bestpractical.com/training

Best regards, Ruslan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130914/ac73e995/attachment.html>

More information about the rt-users mailing list