logo

NJP

Reply mail with set values

Import · Sep 03, 2020 · article

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:

image

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:

image

The result:

image

And in Outlook:

image

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

View original source

https://www.servicenow.com/community/developer-articles/reply-mail-with-set-values/ta-p/2314927