
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2022 10:50 AM - edited 10-10-2022 10:51 AM
Hi ,
I am trying to create a link in a workflow notification, for this I have tried the below email script in Workflow notification but it did not work.
<mail_script>
var gr = new GlideRecord('u_request_item');
gr.addQuery('sys_id',current.u_document_id);
gr.query();
if(gr.next())
{
template.print("Request ID : " +<a href="myinstance.service-now/nav_to.do?uri=u_request_item.do?sys_id=${gr.sys_id}">${gr.number}</a> +'\n');
}
</mail_script>
If it is wrong, help me with it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 10:01 AM
Your quotations (") are all messaged up in your template.print line. Try fixing that and it should be good. I recommend putting your script in a script editor (script field) so you can see any syntax errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2022 11:39 AM
The consensus is to create an event to trigger the notification rather than use the workflow notification.
https://www.servicenow.com/community/developer-forum/script-in-workflow-notification/m-p/1680049

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 04:51 AM
Hi Mike ,
Thanks for the Response.
But I was already having a Notification activity in Workflow with email script , in which it will trigger notification based on the kind of request , now I am just trying to input a link of the Request Item of one type , also a kb article link .
Could you please let me know how can these be achieved in Notification activity in Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 06:11 AM
What table is the workflow running from?
Also which table are you trying to query? I see 'u_request_item' in the GlideRecord. Did you mean 'sc_req_item'?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 09:31 AM
Workflow is running on a custom table lets says the Table name be u_Table and we have another custom Task Table u_request_item , now I have queried here the table u_request_item and trying to have the custom Task record as a link in the workflow notification activity.