Willem
Giga Sage
Giga Sage

Reply mail with set values

In order to let users reply to an email with set values in the Subject and email body you can do the following:

 

The mail script:

find_real_file.png

You can update the subjectTxt and bodyTxt to your liking.

Replace YOURINSTANCEEMAIL@service-now.com with your reply url

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
	var subjectTxt = encodeURI('Re:' + current.number + ' - Please Reopen');
	var bodyTxt = encodeURI('You are requesting to reopen your ticket. Can you please.....');

	template.print('<a title="click here" href="mailto:YOURINSTANCEEMAIL@service-now.com?SUBJECT=' + subjectTxt + '&amp;body='+ bodyTxt + '">Click here</a>');

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

 

 

The email:

find_real_file.png

 

 

 

The result:

find_real_file.png

 

And in Outlook:

find_real_file.png

 

Hope this helps! leave a comment or feedback to help improve the article.

Comments
Mike McCall
Giga Guru

This is a great solution, Willem!

Because ServiceNow used an Email Template record for the out-of-box "mailto.approval" setup, I've also looked into that option. Apparently, the tricks to know when using the Email Template approach are:

  1. The Subject of your template will become the subject of the reply.
  2. The first line of text in your Message HTML will become the clickable text in any notification that displays ${mailto:[your template Name]}.
  3. Every line after the first line of text in your Message HTML will become the body of the reply*.

*Since the mailto.approval setup doesn't make use of #3, I consider that the "secret ServiceNow code" that hopefully remains in place forever.

 

(Thanks for providing a slightly more intuitive option over the secret ServiceNow approach, Willem!)

Version history
Last update:
‎09-03-2020 10:13 AM
Updated by: