Hide Watermark from Outbound Emails

Surbhi Srivasta
Tera Expert

Hi,

I need to hide watermark from Outbound emails getting sent from ServiceNow. I have written a Business rule on Email log (sys_email) table, my script is below. The script works fine when tried with Background script but in Business rule it does not.

I tried adding a log and I cannot see watermark in my log but when I Preview the email it is still there. 

Note: I know we have Omit watermark checkbox on notification record, but for my scenario I cannot use that feature and needs to be done with a script. 

BR Details: Before Insert on sys_email Table

 

(function executeRule(current, previous /*null when async*/) {

	var getEmailBody = current.body;
	var removeWatermark = getEmailBody.match(/Ref:.*[A-Za-z0-9_.]/);
	getEmailBody = getEmailBody.replace(removeWatermark, ' ');
	gs.info('Email body ' + getEmailBody); // This gets print correctly with no watermark but while Preview it is still there.

})(current, previous);

 

 

1 ACCEPTED SOLUTION

Just quickly tested with:

/Ref:[A-z0-9]*/
 
Looks oke.
 
Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

6 REPLIES 6

Just quickly tested with:

/Ref:[A-z0-9]*/
 
Looks oke.
 
Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks @Mark Roethof .

Would you be able to help me out on another question I am stuck with . I posted it here:

https://www.servicenow.com/community/developer-forum/convert-string-to-bytes-using-utf-8/m-p/2614503

 

Regards,

Surbhi