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

Landon Stewart lstewart at iweb.com
Sat Sep 14 15:58:10 EDT 2013


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

> 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.
>

Hi Ruslan,

Thanks for your reply.  I've just tried this but now I'm wondering where I
get the TicketObj and TransactionObj arguments for $template->Parse.  If I
use the Incident's TicketObj and TransactionObj it actually modifies the
Incident's subject.

I cannot put the $new_ticket->Create(…) before the $template->Parse because
RT::Ticket->Create requires a MIMEObj produced by $template->Parse in
$template->MIMEObj.  It's a chicken vs. egg issue here I think.  I must be
missing something but I don't know what.  I also tried putting the "my
$new_ticket = RT::Ticket->new($RT::SystemUser)" above the template but
leave the Create below but I'm still left with no TransactionObj to use
because it's generated by RT::Ticket->Create(…).

I've pasted a new version of my code at http://pastebin.com/UvnUC221.  This
version modifies the subject of the Incident ($self).

-- 
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/20130914/f75045b9/attachment.htm>


More information about the rt-users mailing list