<div dir="ltr">Hello,<div><br></div><div style>This is not an easy issue to work out - I'm sorry for repeating this question but last time I answered myself and then realized the answer wasn't going to work out.  Anyway here goes...</div>

<div><br></div><div>I have a CF called "Classification" where we classify a ticket based on a scoring system for keywords in fields like From:, Subject: and Content of an incoming email report.  The incident report might be classified as one of "Phishing", "Open Recursive DNS" or "Malware" etc.  There are currently 12 different classifications and more may need to be added.  When opening an Investigation for an issue the CF "Classification" is used to determine the template to send to the client containing some helpful information and what is required of them.</div>

<div><div><br></div><div style>Not only are we dealing with multiple templates but also each one has its own language.  English, French and Spanish.  It is very cumbersome to have 3 Scrips for each classification.</div><div style>

<br></div><div style><b><u>Below is 1 example for the "Open Recursive DNS" classification in all three languages and how it is dealt with currently:</u></b></div><div style><br></div><div style><b>Desc:</b> On Create Customer Open Recursive DNS English<br>

</div><div style><b>Condition:</b> User Defined</div><div style><b>Action:</b> Autoreply To Requestor</div><div style><b>Template:</b> Open Recursive DNS (en)</div><div style><b>Stage:</b> TransactionCreate</div><div style>

<b>Custom Condition:</b><br></div><div style><div>my $trans = $self->TransactionObj;</div><div>my $ticket = $self->TicketObj;</div><div>return 0 unless $trans->Type eq "Create";</div><div>return 0 unless $ticket->FirstCustomFieldValue('Classification') eq "Open Recursive DNS";<br>

</div><div>## If English or no language choose English below...<br></div><div>if ($ticket->FirstCustomFieldValue('PreferredLanguage') eq 'English' || $ticket->FirstCustomFieldValue('PreferredLanguage') eq "") {</div>

<div><br></div><div>    return 1;</div><div>}</div><div><br></div><div><div><b>Desc:</b> On Create Customer Open Recursive DNS French<br></div><div><b>Condition:</b> User Defined</div><div><b>Action:</b> Autoreply To Requestor</div>

<div><b>Template:</b> Open Recursive DNS (fr)</div><div><b>Stage:</b> TransactionCreate</div><div><b>Custom Condition:</b><br></div><div><div>my $trans = $self->TransactionObj;</div><div>my $ticket = $self->TicketObj;</div>

<div>return 0 unless $trans->Type eq "Create";</div><div>return 0 unless $ticket->FirstCustomFieldValue('Classification') eq "Open Recursive DNS";<br></div><div>if ($ticket->FirstCustomFieldValue('PreferredLanguage') eq 'French') {</div>

<div>    return 1;</div><div>}</div></div></div><div><br></div><div><div><b>Desc:</b> On Create Customer Open Recursive DNS Spanish<br></div><div><b>Condition:</b> User Defined</div><div><b>Action:</b> Autoreply To Requestor</div>

<div><b>Template:</b> Open Recursive DNS (es)</div><div><b>Stage:</b> TransactionCreate</div><div><b>Custom Condition:</b><br></div><div><div>my $trans = $self->TransactionObj;</div><div>my $ticket = $self->TicketObj;</div>

<div>return 0 unless $trans->Type eq "Create";</div><div>return 0 unless $ticket->FirstCustomFieldValue('Classification') eq "Open Recursive DNS";<br></div><div>if ($ticket->FirstCustomFieldValue('PreferredLanguage') eq 'Spanish') {</div>

<div>    return 1;</div><div>}</div></div></div><div><br></div><div style>"OK!?  So what's the problem?" you might ask…</div><div style><br></div><div style>Can anyone tell me how to roll this into one Scrip without making the templates themselves a mess of spaghetti code?</div>

<div style><br></div><div style><u><b>Pseudo code might be:</b></u></div></div><div><div><b>Desc:</b> On Create Customer Open Recursive DNS<br></div><div><b>Condition:</b> User Defined</div><div><b>Action:</b> Autoreply To Requestor</div>

<div><b>Template:</b> Global template: Blank</div><div><b>Stage:</b> TransactionCreate</div><div><b>Fake Code Custom Condition:</b><br></div><div><div>my $trans = $self->TransactionObj;</div><div>my $ticket = $self->TicketObj;</div>

<div>return 0 unless $trans->Type eq "Create";</div><div style>my $class = $self->FirstCustomFieldValue('Classification');</div><div style>my $lang = $ticket->FirstCustomFieldValue('PreferredLanguage');</div>

<div style>my $template = $class." (".$lang.")";                                           ## Eg: Open Recursive DNS (French)</div><div style>if (SetTheTemplateTo($template)) {<br></div><div style>  return 1;</div>

<div style>}</div><div style>return 0;</div><div style><br></div></div></div><div style>I know SetTheTemplateTo() is not a real function… But that's what I want to work out how to do.  Basically override or supplement the template set on the Scrip form.</div>

<div><br></div><div><br></div>-- <br><div dir="ltr"><div><span style="font-family:arial;font-size:small">Landon Stewart :: </span><a href="mailto:lstewart@iweb.com" style="font-family:arial;font-size:small" target="_blank">lstewart@iweb.com</a><br>

</div><span style="font-family:arial;font-size:small">Lead Specialist, Abuse and Security Management</span><br style="font-family:arial;font-size:small"><span style="font-family:arial;font-size:small">Spécialiste principal, gestion des abus et sécurité</span><br style="font-family:arial;font-size:small">

<span style="font-family:arial;font-size:small"><a href="http://iweb.com" target="_blank">http://iweb.com</a> :: +1 (888) 909-4932</span><br><div><span style="font-family:arial;font-size:small"><br></span></div><div><span style="font-family:arial;font-size:small"><br>

</span></div></div>
</div></div>