Amending priority wording on an email notification

nicolabroad
Tera Expert

Hi,

I am configuring some email notifications and the priority shows with a word next to the priority number, for example, when adding ${priority} to the email subject line, it displays in the email as 'Priority 4 - Low'. I would like it to show only as 'Priority 4' or 'P4' instead of showing 'Low' on the end. Is there a way to amend this to only show the number rather than the wording?

Thank you 

1 ACCEPTED SOLUTION

You can't add the mail script to the subject line, but you can set the subject line within the mail script. You would do it something like this:

var str = 'Your subject';
email.setSubject(str);

View solution in original post

6 REPLIES 6

JenniferRah
Mega Sage

You will have to use a mail script to do that. In the notification, where you want the priority to print, you would put this:

${mail_script:priority_format}

 

Then create a mail script named priority_format that has the following code:

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {
    template.print('P' + current.priority.getValue().toString());
})(current, template, email, email_action, event);

 

You can modify it to suit however you want it to print out.

Hi Jennifer, 

This is really useful thank you. Is there a way I can add this to the subject line as well as the body?

Thank you

You can't add the mail script to the subject line, but you can set the subject line within the mail script. You would do it something like this:

var str = 'Your subject';
email.setSubject(str);

Thank you!