[Rt-devel] "Create Ticket" action problems

sam.howard at gmxtechnologies.com sam.howard at gmxtechnologies.com
Wed Dec 14 11:43:01 EST 2005


I tried this on the rt-user list, but got no response ... maybe this is 
deeper than a normal user question?


We're trying to create "subtask" tickets from the creation of a "master" 
ticket based on the settings of various custom fields.  For each custom 
field, if the value is "Required", then create a new ticket and link it 
back to the "master".  Seems simple enough and seems like a job for the 
"Create Tickets" action in a TransactionBatch.

The problem:

When in the template for the "Create Tickets" action, the perl parser 
seems to be executed *after* the initial parsing of the template file, 
which seems to search for "===Create-Ticket" lines to create a hunk of 
data to use for creating each ticket.  This prevents me from using perl 
in the template to generate the "===Create-Ticket" stanzas (since the 
"===Create-Ticket" must be there for the initial parse *prior* to the 
perl code evaluation).  I'm wondering if this would be considered a bug 
in the "Create Ticket" action?  It's certainly a pain in the ass.  :)

So, I am bailing out of that idea and switching to "TransactionStage" 
and processing each ticket one at a time.  Next problem I ran into was 
figuring out what data objects are available within the "Create Ticket" 
action's template.  Stuff like $self, $ticket, and $transaction do not 
appear to be defined!  I do have a $Tickets{'TOP'}, and 
$Tickets{'TOP'}->Transactions does return a perl object, but none of the 
methods and data I expect to be associated with a Transaction are there 
(i.e. $trans->Field).  How can I dump the contents of this object to 
figure out what's actually in there and available?

Basically, I am stuck.  I can get the data I need in TransactionBatch, 
but I can't dynamically create the template for the multiple 
Create-Ticket's, and I can create the template I need in 
TransactionStage, but can't get to the data of the transaction to find 
out which custom field was flipped (and therefor what queue to create 
the ticket in).

As my last resort, I was going to do a User Defined action or a regular 
notify action with a template that will expose the $Transaction to me, 
but I haven't figured out how to create a ticket the "hard way" yet 
(i.e. the RT API).  Any pointers to that would be welcome, as I haven't 
found anything on the Wiki or in the book (nice book, btw ... I hope RT 
Programming is comming out next!)

I can provide code chunks, configuration details, whatever, but I 
figured this note was long enough already, so please ask if you want 
more details or copies of the code I've tried.


More information about the Rt-devel mailing list