[rt-users] help with incoming scrip

Chris Haumesser ch at awry.ws
Mon Apr 14 13:22:19 EDT 2008


I think I've got this one licked.

I'll be doing a full write-up of my project at www.awry.ws in a few days.


> 1.  With other templates, you would use "$Transaction->" instead of 
> "$self->TransactionObj->".  I don't know whether this is true for this 
> extension.  The "$self" notation generally applies to scrips.


Yes, as it turns out, ExtractCustomFieldValues.pm defines $Transaction 
and $Ticket for me thusly:

   my $Transaction = $self->TransactionObj;
   my $Ticket = $self->TicketObj;

so one can use simply $Transaction or $Ticket.


> 2.  It looks like you're setting the subject of the transaction rather 
> than the ticket.  I'd try "$Ticket->Set(Subject=>$_)" assuming that the 
> Set syntax is correct.  Or "$self->TicketObj->Set(Subject=>$_)" if I'm 
> off-base with observation #1.


Yup, figured that out, too.  The final magic for the template ended up 
being:

|body|^Title:\s*(.*)$|$Ticket->SetSubject($_);|


I also had a hell of a time just getting ExtractCustomFieldValues to 
operate at all on the message body, until I realized that the "newest 
version always here" link on 
http://wiki.bestpractical.com/view/ExtractCustomFieldValues doesn't 
point to the newest version after all.  My progress accelerated 
considerably once I got the right code!  ;)

Still, the ExtractCustomFieldValues.pm only looks at the first 
attachment to a ticket, so it doesn't work on multipart messages.  I had 
to rework the module a bit to have it iterate over all attachments 
instead.  Modified pm is here: http://tinyurl.com/3kh37e (untested - YMMV).


Learning perl is, uh... fun.  ;-)



-C-



More information about the rt-users mailing list