Add text in the email subject

Anoja
Mega Sage

Hi,

We have a record producer form with the variable "xyz" type is select box with the choices "yes" and "no" . If we select "yes" the text "call is required" should add in the beginning of the subject line with in the existing notification.

Thanks in Advance.

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Create a mail script by navigating to System Notification >> Email >> Notification mail script named: check_variable_add_subject

with below script

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    var subj = email.getSubject();//get current subject from notification
    var checkvariable = current.variables.variable_name; //replace variable_name with yes no variable name 
    if (checkvariable == 'true' || checkvariable == true) {
        email.setSubject('Call is required - ' + subj);
    }
})(current, template, email, email_action, event);

 

Use ${mail_script:check_variable_add_subject} in the notification's Message field in What it will contains tab.

Above will work considering notification is on RITM or Incident table or any other table that has variables accessible directly.

View solution in original post

2 REPLIES 2

Jaspal Singh
Mega Patron
Mega Patron

Create a mail script by navigating to System Notification >> Email >> Notification mail script named: check_variable_add_subject

with below script

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    var subj = email.getSubject();//get current subject from notification
    var checkvariable = current.variables.variable_name; //replace variable_name with yes no variable name 
    if (checkvariable == 'true' || checkvariable == true) {
        email.setSubject('Call is required - ' + subj);
    }
})(current, template, email, email_action, event);

 

Use ${mail_script:check_variable_add_subject} in the notification's Message field in What it will contains tab.

Above will work considering notification is on RITM or Incident table or any other table that has variables accessible directly.

Yogi12
Tera Contributor

Hi Jaspal,

Can you please tell what to put in the subject field ??

I have added an attachment for reference.

Thanks

Yogindra Malik