- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 12:33 AM
Hi
I have configured one email notification on Approval(sys_approval) table.
for my notification content i need to include the request(custom request table) URL in my body of email notification.
since it need to navigate to portal page. I have written an email script and called the mail script in the notification.
when email is triggered the request URL link was labeled as undefined.
Please help me.
I have called my mail script in body html(${mail_script:req_details})
email script:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var reqNum;
var uniqueID = current.getUniqueValue();
var req = new GlideRecord('my_request_table');
req.addQuery('sys_id', uniqueID);
req.query();
if (req.next()) {
reqNum = req.number + '';
}
var url = '<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/display-request/my_request_table/' + uniqueID + '">' + reqNum + '</a>';
template.print(url);
})(current, template, email, email_action, event);
Please help me why it is showing undefined (when i click on URL it was navigating to target record.).
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 12:43 AM
Hi,
Replace
var uniqueID = current.getUniqueValue();
with
var uniqueID = current.sysapproval;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 12:43 AM
Hi,
Replace
var uniqueID = current.getUniqueValue();
with
var uniqueID = current.sysapproval;
