jonnyseymour
ServiceNow Employee
ServiceNow Employee

Adding a watermark in the subject takes an enviable position at the top of emails sent, backing its presence on the body and offering an alternative option to match with existing records.

I'll show you examples of:

  • Mail Scripts to implement the email subject changes
  • Appending the notification watermark into the subject
  • Why would you append the watermark in the subject

Watermarks are relevant when working with incoming emails classified as reply by an algorithm. By default, the system generates a watermark label at the bottom of each notification email to allow matching incoming email to existing records. The watermark always includes "Ref:" and a customizable prefix (default MSG), followed by the auto-numbered identifier of the source record (such as incident, problem, or change request). For example, Ref:MSG3846157

You have the option on the email notifications to add or omit the watermarks. However, you do not have the choice to add it to the subject. That is the reason we will need to implement a mail script to add the watermark into the subject.

email-validation-terms-21a.png

Mail Scripts to implement the subject changes

Mail scripts allow for business rule-like scripting within an outbound email message. With mail scripts, you can dynamically change the email output of your system based on different criteria. Mail scripts allow you to perform simple tasks, such as displaying incident data, and complex ones, such as making advanced database queries.

Create mail scripts in System Policy > Email > Notification Email Script

To make them run, then add a ${mail_script:script name} embedded script tag to the body of the email notification or template,replacing script name with the name of the script you created. This makes it easy to use the same scripts in multiple email notifications or templates.

We will be using the email properties to modify the subject of the notification.

Appending the notification watermark into the subject

To append the watermark into the subject of the notification, I created a new mail script.

Name = subject_watermark

addwatermarktosubject();

// This function will attach the watermark at the end of the subject

function addwatermarktosubject() {

      var vsubject = [email.getSubject(), email.watermark ].join(' ');

      email.setSubject(vsubject);

}

mail script.jpg

Then I created a notification with the following qualities:

Notification

Name

=

test_subject

Table

incident

Inserted

CHECKED

Updated

CHECKED

Users

ae@example.com

Subject

Any Subject

Message

Test

${mail_script:subject_watermark}

test email.jpg

When I make a change on the incident table, the result is a notification is triggered and the email subject has the watermark appended as intended.

append watermark email.jpg

Why would you append the watermark in the subject

There are several reasons you would like to make the watermark part of the subject. First, the system will first search the watermark on the subject. Second, watermarks on the body can be deleted without noticing them. Third, it makes watermark importance more evident for the customer. And finally, the text "Ref:" can be found on the body without being a real watermark.

There are a few cons, or negatives, about including a watermark in the email subject. Watermarks can not be hidden in the HTML body. It is also aesthetically not as pleasing as having the subject alone, without the watermark. It also makes the subject longer, which can be a turn off.

Adding the watermark on the subject provides flexibility when working with reply emails. It just requires creating a mail script that appends the watermark to the subject.

I tested this on Fuji with Chrome as browser.

More information on email watermarks see: