Help with approval link.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2018 09:41 AM
Hello All, I need help in generating link to the approval page.
Below is What I have done so far, but I get "record not found" everytime I click on "this link".Seems like its picking wrong sysid, but need guidance how to get this working.
Requirement:
Approver gets email with link to approve a given RITM, this link should take him to the approval page. I have Admin rights, so its not a permission issue.
When I click on "This link" Getting Record could not be found.
The Script that generates the link is below:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var url = 'https://'+ gs.getProperty("instance_name") +'.service-now.com/biomarin_sp?id=approval&table=sysapproval_approver&sys_id='+current.sys_id;
template.print('<a href='+url+'>this link</a>');
})(current, template, email, email_action, event);
The notification that triggers this script is defined in the WF itself:
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2018 10:10 AM
var url = '<a href="' + link + '"> This Link</a>';
template.print(url);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2018 10:49 AM
Hello Harish, I updated the script and still get Record not found.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2018 10:15 AM
nkpanesar,
you may be correct with using the wrong sys id. The first question would what is triggering this notification and what exactly current.sys_id is referring to. If this is triggered from a RITM, where current is sc_req_item, then yes, the current.sys_id would not give you a valid approval record.
If that is the case there are several things you could do, trigger event from approvals table, or in the mail script, query for the appropriate approval related to your RITM and use that record sys id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2018 10:50 AM
Yes, I think its picking from sc_req_item.
I do not want to make event based notification, can you help with updating the query to look for right table?