Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

approve button link to reply-to email window

Servicenow10
Kilo Guru

hi 

i have designed a notification which looks like this:

 

find_real_file.png

 

now what i need to do is once i click on approve button it  open a reply-to email window. Just Click 'Send' to forward the email back to ServiceNow and approve the request. The reply email is linked directly to the approval request in ServiceNow and it will look like below image

 

 

find_real_file.png

how can i achieve this through email script or any other way......please explain me in detail as am new to now and scripting

 

thanks in advance!!

1 ACCEPTED SOLUTION

Omkar Joshi
Giga Guru

Hi,

Use the below code in email script

 

 

 

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

var apButStr = '<div><a href="mailto:dev11111@service-now.com?subject=re:' + current.number + ' - approve&body='+ current.number + ' - approve' +'"><br /><img style="align: baseline;" title="Click this button to mark approved" src="/approveButton.pngx" alt="Approved" width="142" height="41" align="baseline" /></a>';

var rejButStr = '<a href="mailto:dev11111@service-now.com?subject=re:' + current.number + ' - reject&body='+ current.number + ' - Reject' +'"><img style="align: baseline;" title="Click this button to mark rejected" src="/rejectButton.pngx" alt="Rejected" width="142" height="41" align="baseline" /></a></div>';

var full = apButStr + rejButStr;

template.print(full);

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

 

 

Note:Use your instance URL.

View solution in original post

16 REPLIES 16

Omkar Joshi
Giga Guru

Hi,

Use the below code in email script

 

 

 

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

var apButStr = '<div><a href="mailto:dev11111@service-now.com?subject=re:' + current.number + ' - approve&body='+ current.number + ' - approve' +'"><br /><img style="align: baseline;" title="Click this button to mark approved" src="/approveButton.pngx" alt="Approved" width="142" height="41" align="baseline" /></a>';

var rejButStr = '<a href="mailto:dev11111@service-now.com?subject=re:' + current.number + ' - reject&body='+ current.number + ' - Reject' +'"><img style="align: baseline;" title="Click this button to mark rejected" src="/rejectButton.pngx" alt="Rejected" width="142" height="41" align="baseline" /></a></div>';

var full = apButStr + rejButStr;

template.print(full);

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

 

 

Note:Use your instance URL.

hi omkar,

 

i followed your steps and its working absolutely fine

thanks you so much for your effort a

 

note: if you are doing any activity related to emails then please check your email properties first

because of that code wasn't working

For that you need to use the inbound email action.

omkar can you please tell me the steps

i am beginner so don't have much idea