AW: Re: Scrips: User Defined actions and Templates

Hi gene,

Ich think at the wiki is under contributions some action like sendmail which parses the template for the rest.From: rt-users-bounces@lists.bestpractical.com rt-users-bounces@lists.bestpractical.com
To: Stephen Turner sturner@MIT.EDU; RT Users rt-users@lists.bestpractical.com
Sent: Mon Mar 26 18:20:23 2007
Subject: Re: [rt-users] Scrips: User Defined actions and Templates

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.

At 06:28 AM 3/26/2007, Stephen Turner wrote:

At Friday 3/23/2007 07:34 PM, Gene LeDuc wrote:

Hi All,

I want a scrip to use both a User Defined action and a template. My
understanding is that selecting User Defined for the action means that
the template won’t get run. It would be nice to run my “prep” code to
modify a ticket, launch the template, then run my “cleanup” code. Is
there a command that I can put into my custom action that will launch
either an arbitrary template or the one that is in the Template field?

Thanks,
Gene

Hello Gene,

You can define a custom (user defined) action and still have it use a
template. But the template will just define the content of the email
message sent by the action, and so will only come into play if the action
results in an email message. There’s no way in which a template can be
’launched’.

Steve

Gene LeDuc, GSEC
Security Analyst
San Diego State University

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com