Dynamic choice of templates based on the value of a CF

We classify tickets based on content and store that classification as a
string in a CF called CF.{Classification}. This is an RTIR instance but
that is not really relevant other to say that when we open an Investigation
on an Incident we want the template that is used for the Investigation to
be dynamic based on the value of the CF.{Classification} field.

Currently what I’m doing is I have a Scrip for each Classification with a
condition for that classification as well as the “On Create” condition.
When each Scrip fires it checks to see if the Investigation is that
Classification. If it is the template associated with the Scrip is used.
This is messy because it requires a Scrip for each Classification.

Instead one Scrip for “On Create” that chooses the template dynamically.

What I think I can do is simply have one very short Template that is
basically 100% perl and includes some text from a text file stored on the
file system but outside RTIR. Which file gets included in the Template is
dependent upon the CF.{Classification}.

ie:
{ require
“/path/to/templates/”.$Ticket->FirstCustomFieldValue(‘Classification’).“.template”;
}

Would this even work? Is there a better way to choose a Perl template in
the Scrip so that templates can be kept within RT?

Landon Stewart :: lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932

What I think I can do is simply have one very short Template that is
basically 100% perl and includes some text from a text file stored on the
file system but outside RTIR. Which file gets included in the Template is
dependent upon the CF.{Classification}.

ie:
{ require
“/path/to/templates/”.$Ticket->FirstCustomFieldValue(‘Classification’).“.template”; }

Actually I believe I found the answer which I’m going to try… I basically
need a hybrid of these two because we also send different copies of
templates depending on the language the customer prefers to be communicated
with in.

http://requesttracker.wikia.com/wiki/ForkTemplate
http://requesttracker.wikia.com/wiki/ChooseTemplateByUserLang

So - never mind my original post unless you have any information that’s
better than the two ones above.

Landon Stewart :: lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932

Actually I believe I found the answer which I’m going to try… I basically
need a hybrid of these two because we also send different copies of
templates depending on the language the customer prefers to be communicated
with in.

http://requesttracker.wikia.com/wiki/ForkTemplate
http://requesttracker.wikia.com/wiki/ChooseTemplateByUserLang

So - never mind my original post unless you have any information that’s
better than the two ones above.

Well after trying and trying - none of this has worked because
SetTemplate() is no longer a valid method for Conditions in RT 4.0.17 among
other reasons.

If anyone has any information on how to dynamically set the Template in a
Scrip with RT 4.0.x I would greatly appreciate it!

Landon Stewart :: lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932

In the past I ended up turning the templates into perl programs. I made
all the decisions within the template and then built the output based on
that logic. It wasn’t very pretty (it was ugly, actually), but it
worked flawlessly for years. Gotta be careful with maintenance on the
templates, though, because a seemingly unrelated change in one part of
the template sometimes was more related to other parts of the template
than we thought.

GeneOn 9/6/2013 1:33 PM, Landon Stewart wrote:

On 6 September 2013 11:55, Landon Stewart <lstewart@iweb.com mailto:lstewart@iweb.com> wrote:

Actually I believe I found the answer which I'm going to try�  I
basically need a hybrid of these two because we also send different
copies of templates depending on the language the customer prefers
to be communicated with in.

http://requesttracker.wikia.com/wiki/ForkTemplate
http://requesttracker.wikia.com/wiki/ChooseTemplateByUserLang

So - never mind my original post unless you have any information
that's better than the two ones above.

Well after trying and trying - none of this has worked because
SetTemplate() is no longer a valid method for Conditions in RT 4.0.17
among other reasons.

If anyone has any information on how to dynamically set the Template in
a Scrip with RT 4.0.x I would greatly appreciate it!


Landon Stewart :: lstewart@iweb.com mailto:lstewart@iweb.com
Lead Specialist, Abuse and Security Management
Sp�cialiste principal, gestion des abus et s�curit�
http://iweb.com :: +1 (888) 909-4932