The CreatorCon Call for Content is officially open! Get started here.

notifications with response links

Jack62
Giga Guru

Good evening all

 

We have a requirement in a specific notification in which we want two links, Yes and No, which will open a new email for the user to then send into ServiceNow, which could also include the watermark to update the incident the email was generated from, can anyone advise on the best method for this?

 

Thanks

 

Justin

1 REPLY 1

Kieran Anson
Kilo Patron

Hi Justin,

Yes this is possible. You'd use a mail script. An example below

(function runMailScript(current, template, email, email_action, event) {

	var WATERMARK = email.watermark;
	var MAIL_TO_PREFIX = 'mailto:';
	var EMAIL_ADDRESS = 'dev@service-now.com';

	var subject = "Some Text Here";
	var body = "some text here \n" + WATERMARK;
	var linkText = "Click Here to do something";

	template.print(gs.getMessage('<a href="{0}{1}?subject={2}&body={3}">{4}</a>',[
		MAIL_TO_PREFIX, //0 - click prefix so email client opens
		EMAIL_ADDRESS, //1 - Email address for "to",
		encodeURIComponent(subject), //2 - is the subject line of the email
		encodeURIComponent(body), //3 - content of email, include watermark for SN to process
		linkText //4 - Text displayed as a clickable link
	]));

})(current, template, email, email_action, event);

I called my script email script 'kma_mail_to' and used this in a notification by adding the following into the mail body

${mail_script:kma_mail_to}

Output

KieranAnson_0-1717448395046.png