Skip to content

Commit 43f482a

Browse files
authored
Approve Reject buttons using email script (#1432)
* Create script.js * Delete Background scripts directory * Create Convert comma separated values in string to columns * Delete Convert comma separated values in string to columns * Create MID Server availability inside MID cluster.js * Create reame.md * Update MID Server availability inside MID cluster.js * Delete Flow Actions/Check MID Servers status inside MID Server cluster directory * Create readme.md * Update readme.md * Create Script.js * Update readme.md * Update and rename Script.js to Email Script.js * Update readme.md
1 parent a7fc6d3 commit 43f482a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
2+
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
3+
/* Optional GlideRecord */ event) {
4+
var emailID = gs.getProperty('instance_name')+"@service-now.com"; //Get your intance address
5+
var apButStr = '<a href="mailto:'+emailID+'?subject=Re:'+current.sysapproval.number+' - approve&body='+ email.watermark +'"><img src="/approve.png" alt="Approve" width="94" height="34"></a>'; //instructions to load approve image has been provided in the readme.md file
6+
var rejButStr = '<a href="mailto:'+emailID+'?subject=Re:'+current.sysapproval.number+' - reject&body='+ email.watermark +'"><img src="/reject.png" alt="Reject" width="93" height="33"></a>'; //instructions to load reject image has been provided in the readme.md file
7+
template.print(apButStr +'&nbsp;&nbsp;'+ rejButStr);
8+
9+
})(current, template, email, email_action, event);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Use Case: Set up Approve and Reject buttons using Email script to Approve/Reject through Email (Use thisv email script on the sysapproval_approver Table Notifications)
2+
3+
1)Upload below images to DB tables in ServiceNow (System UI> Images)and use them in email scripts
4+
5+
Approve Button Image : ![image](https://github.com/user-attachments/assets/a7113ce8-7acf-4c78-af29-dde41a816332)
6+
7+
Reject Button Image: ![image](https://github.com/user-attachments/assets/9b01e1c8-b8f2-4a14-8274-a7d4d4fdbf73)
8+
9+
10+
2)Go to Email Scripts > Click new
11+
3)Add Scripts (Refer Email script file)
12+
4)Call this in email in your Notification by using below syntax below
13+
${mail_script:"name of the email script"}
14+
5)Preview the email verify results
15+
16+
Output: ![image](https://github.com/user-attachments/assets/6c65a977-de11-4abd-918f-a4edeab4b2ce)

0 commit comments

Comments
 (0)