Dynamic Template selection from a UserDefined scrip

Hi,

I am trying to get a scrip to dynamically select a template,
based on the value of a custom field. I have created a custom
field called test (populated with the value test) and a template with
the same name.

It seems to execute properly but the template is not used to mail
a response (even though use of an RT::Logger confirms that it is
being loaded).

Any ideas would be greatly appreciated.

Regards
Andre Sachs

This is what my scrip looks like:

Condition: UserDefined
Custom Condition:
return 1; # test installation

Action: UserDefined
Custom action preparation code:

my $template_name = $self->TicketObj->FirstCustomFieldValue("test");
my $template = new RT::Template($RT::SystemUser);
$template->LoadGlobalTemplate($template_name);
$self->{'TemplateObj'} = $template;

return 1;

Custom action cleanup code:
return 1;

Stage: TransactionCreate
Template: Global: Blank

Andre Sachs
Software Developer
Clue Consulting

Andre Sachs wrote:

Hi,

I am trying to get a scrip to dynamically select a template,
based on the value of a custom field. I have created a custom
field called test (populated with the value test) and a template with
the same name.

It seems to execute properly but the template is not used to mail
a response (even though use of an RT::Logger confirms that it is
being loaded).

Any ideas would be greatly appreciated.
RT doesn’t support stacked scrips, but notifications are handled by
ScripAction too.

http://wiki.bestpractical.com/index.cgi?ChooseTemplateByUserLang