[rt-users] Scrips: User Defined actions and Templates

Stephen Turner sturner at MIT.EDU
Mon Mar 26 12:43:47 EDT 2007


At Monday 3/26/2007 12:20 PM, Gene LeDuc wrote:
>Hi Stephen,
>
>How do I get the user-defined action to result in an e-mail so that 
>the template is used?  The reason I used "launch" in my original 
>post (when referring to my templates) is that I've had to embed a 
>bunch of code that modifies the ticket into my templates in order to 
>get both an e-mail and changes to the ticket in a single step.  So 
>they are really programs (in an e-mail wrapper) that get launched 
>when the condition is true.  I'd prefer to put the code in the scrip 
>and let the template just handle formatting the mail, but I don't 
>know how to get the custom action to generate an e-mail using the 
>template.  Is there a command like "RT::SendEmailUsingScripTemplate"?
>
>What I've done is probably confusing, but it's like this:
>1. Mail comes in to queue 1.  A scrip extracts some data and 
>populates some custom fields, sets the priority, and moves the 
>ticket to queue 2.
>2. Ticket enters queue 2.  Scrip fires and uses Notify Others action 
>to "launch" a template.
>3. Template modifies some fields in the ticket and creates e-mail to 
>action address.
>4. Action address does their job and replies to mail with 
>"ok".  Scrip in queue 2 triggers, modifies some fields in the 
>ticket, moves ticket back to queue 1.
>5. Lather, rinse, repeat a couple more times.
>
>What I want to do is take the code that modifies the ticket out of 
>the template at step 3 and put it into the scrip at step 2, but I 
>don't know how to get the scrip to use the template after making the 
>changes to the ticket.  I thought that putting the code in the prep 
>code and returning a "1" would do it, but nothing happens with the template.

Gene,

Maybe it's because it's Monday morning, but I wasn't thinking clearly 
when I wrote earlier - I apologize. I don't actually know how to make 
a custom action generate an email message that will use the scrip 
template. As Torsten said I think there's something on the wiki, but 
I couldn't find it.

You could put your code into a custom condition instead of a custom action.

Or you could create a new action in the lib/Actions directory and 
insert into the ScripActions table to make this available as a scrip 
action in the UI. There's an example of this on the wiki: 
http://wiki.bestpractical.com/index.cgi?NotifyNonRecipients but I 
haven't used this particular piece of code.

Steve 




More information about the rt-users mailing list