[rt-users] addition condition checking for scrips
Bob Goldstein
bobg at uic.edu
Thu Jul 8 16:49:14 EDT 2004
>
>How would I add additional conditions to already existing conditions for
>scrips?
>
>I want to have various templates for emails based on various conditions. I
>would like to be able to create a scrip for a "On Create" condition and have
>one or more other conditions. One of the scrips will fire and be associated
>with the appropriate template. Only way I can see is to create custom
>condition checking code that would replace the "On Create" condition and
>contain my additional conditions as well.
>
>Or is there a way I could dynamically change the associated template during
>runtime, based on values or state of the ticket.
>
3 options, if I understand correctly.
1. An RT "template" is fed to HTML::Template. So in reality,
a template can accomodate any amount of perl inside braces.
You can write a dynamic template that checks conditions
and outputs accordingly.
2. Create a user defined scrip for each condition.
In each such scrip, you fully code the condition
on the gui when you make the scrip. The codition will check
for create status, and whatever else you need. I think
this is the option you mentioned originally.
3. Create one or more custom ScripConditions (as opposed to Scrips).
This invovles writing a little code to be kept with the RT
libraries, and inserting rows into the ScripConditions
table. Then you can use these new conditions in new scrips,
using the dropdown box rather than adding custom code to
the scrip itself. This is a bit more complicated;
however when you insert into the table ScripConditions,
you must specify which code to execute (the new library file
you wrote), what argument to pass it (if any), and what
transaction state applies. The transaction state is
something like create, correspond, any, ... The point being,
the test for "create" is very simply handled right in
the sql table, and your code can check for the other
things of interest to you.
bobg
More information about the rt-users
mailing list