- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 02:53 PM
I have a notification generated from rejection of an approval related to change. How can I include link to Approval record in the email. For change link I used ${URI_REF} but not sure how to access the Approval record.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 08:23 PM
so notification is triggering from workflow on CHG table.
2 ways
1) To show link to approval record you will have to use email script in workflow notification activity
<mail_script>
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", current.sys_id);
gr.query();
if (gr.next()) {
var sysId = gr.sys_id;
var tableName = 'sysapproval_approver'; // table name
var instance_name = gs.getProperty('glide.servlet.uri');
template.print('Click here <a href="' + instance_name + tableName +'.do?sys_id="' + sysId + '">' + 'Approval Record' + '</a>');
}
</mail_script>
See how you can add that below
OR Another Approach
2) you can use run script to store the link in workflow scratchpad and then use that workflow scratchpad in message of workflow notification activity
Run Script:
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", current.sys_id);
gr.query();
if (gr.next()) {
var instance_name = gs.getProperty('glide.servlet.uri');
workflow.scratchpad.approvalLink = 'Click <a href="' + instance_name + tableName + '.do?sys_id="' + taskID + '">' + taskNum + '</a> to view the Task.';
}
Then use this in workflow notification message part
${workflow.scratchpad.approvalLink}
Here in below image use ${workflow.scratchpad.approvalLink} to show that link
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 03:29 PM - edited ‎04-07-2025 03:31 PM
If your notification is on the change_request table, you could try the following URL in your notification to get to the approval record:
/nav_to.do?uri=sysapproval_approver.do?sysparm_query=sysapproval.number=${number}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 04:43 PM
Its notification in the workflow not created on the table itself
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2025 08:23 PM
so notification is triggering from workflow on CHG table.
2 ways
1) To show link to approval record you will have to use email script in workflow notification activity
<mail_script>
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", current.sys_id);
gr.query();
if (gr.next()) {
var sysId = gr.sys_id;
var tableName = 'sysapproval_approver'; // table name
var instance_name = gs.getProperty('glide.servlet.uri');
template.print('Click here <a href="' + instance_name + tableName +'.do?sys_id="' + sysId + '">' + 'Approval Record' + '</a>');
}
</mail_script>
See how you can add that below
OR Another Approach
2) you can use run script to store the link in workflow scratchpad and then use that workflow scratchpad in message of workflow notification activity
Run Script:
var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", current.sys_id);
gr.query();
if (gr.next()) {
var instance_name = gs.getProperty('glide.servlet.uri');
workflow.scratchpad.approvalLink = 'Click <a href="' + instance_name + tableName + '.do?sys_id="' + taskID + '">' + taskNum + '</a> to view the Task.';
}
Then use this in workflow notification message part
${workflow.scratchpad.approvalLink}
Here in below image use ${workflow.scratchpad.approvalLink} to show that link
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2025 07:51 PM
Utilized the mail script in the workflow notification. Thank you.