[rt-users] Back to my Dynamic template choosing Scrip problem...

Landon Stewart lstewart at iweb.com
Wed Oct 2 16:59:16 EDT 2013


Hello,

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...

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.

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.

*Below is 1 example for the "Open Recursive DNS" classification in all
three languages and how it is dealt with currently:*

*Desc:* On Create Customer Open Recursive DNS English
*Condition:* User Defined
*Action:* Autoreply To Requestor
*Template:* Open Recursive DNS (en)
*Stage:* TransactionCreate
*Custom Condition:*
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
return 0 unless $trans->Type eq "Create";
return 0 unless $ticket->FirstCustomFieldValue('Classification') eq "Open
Recursive DNS";
## If English or no language choose English below...
if ($ticket->FirstCustomFieldValue('PreferredLanguage') eq 'English' ||
$ticket->FirstCustomFieldValue('PreferredLanguage') eq "") {

    return 1;
}

*Desc:* On Create Customer Open Recursive DNS French
*Condition:* User Defined
*Action:* Autoreply To Requestor
*Template:* Open Recursive DNS (fr)
*Stage:* TransactionCreate
*Custom Condition:*
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
return 0 unless $trans->Type eq "Create";
return 0 unless $ticket->FirstCustomFieldValue('Classification') eq "Open
Recursive DNS";
if ($ticket->FirstCustomFieldValue('PreferredLanguage') eq 'French') {
    return 1;
}

*Desc:* On Create Customer Open Recursive DNS Spanish
*Condition:* User Defined
*Action:* Autoreply To Requestor
*Template:* Open Recursive DNS (es)
*Stage:* TransactionCreate
*Custom Condition:*
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
return 0 unless $trans->Type eq "Create";
return 0 unless $ticket->FirstCustomFieldValue('Classification') eq "Open
Recursive DNS";
if ($ticket->FirstCustomFieldValue('PreferredLanguage') eq 'Spanish') {
    return 1;
}

"OK!?  So what's the problem?" you might ask…

Can anyone tell me how to roll this into one Scrip without making the
templates themselves a mess of spaghetti code?

*Pseudo code might be:*
*Desc:* On Create Customer Open Recursive DNS
*Condition:* User Defined
*Action:* Autoreply To Requestor
*Template:* Global template: Blank
*Stage:* TransactionCreate
*Fake Code Custom Condition:*
my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
return 0 unless $trans->Type eq "Create";
my $class = $self->FirstCustomFieldValue('Classification');
my $lang = $ticket->FirstCustomFieldValue('PreferredLanguage');
my $template = $class." (".$lang.")";
    ## Eg: Open Recursive DNS (French)
if (SetTheTemplateTo($template)) {
  return 1;
}
return 0;

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.


-- 
Landon Stewart :: lstewart at iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com :: +1 (888) 909-4932
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20131002/755a1ecb/attachment.htm>


More information about the rt-users mailing list