- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2020 03:38 PM
Hello. In an email notification, I am trying to Link to a record in Workspace. So that when a task is assigned, the link will open up the specific task in Agent Workspace. I am following this documentation.
https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/notification/concept/c_EnablingLinksToServiceNowRecords.html
The link is taking me to the workspace, but is truncating the task record number after the link is opened. So when I open the link, the url will show as:
https://myinstance.service-now.com//now/workspace/agent/record/sc_task/5ccc7e9f1b75d010ba454261cd4bcbc
but then cuts off the task number to:
https://myinstance.service-now.com//now/workspace/agent/record/sc_task/
and opens up agent workspace home page.
I wonder if anyone else has had this issue? Appreciate any comments.
Mark S
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2020 03:55 PM
Well, I'll answer my own question in case anyone has the same issue.
The documented mailscript points to a system property call - glide.servlet.uri
// Dynamically construct an Agent Workspace URL and insert a link in the notification
var agentURL = '<a href="' + gs.getProperty('glide.servlet.uri') + '/now/workspace/agent/record/'+ current.getTableName() + '/' + current.sys_id + '">' + current.number + '</a>';
template.print(agentURL + "<br />");
I looked at our instance and found this property does not exist, but we had one called ' glide.sys.servlet_path '. Funnily enough it doesn't have a value. I replaced
gs.getProperty('glide.servlet.uri') with
gs.getProperty('glide.sys.servlet_path') and the links worked fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2020 03:55 PM
Well, I'll answer my own question in case anyone has the same issue.
The documented mailscript points to a system property call - glide.servlet.uri
// Dynamically construct an Agent Workspace URL and insert a link in the notification
var agentURL = '<a href="' + gs.getProperty('glide.servlet.uri') + '/now/workspace/agent/record/'+ current.getTableName() + '/' + current.sys_id + '">' + current.number + '</a>';
template.print(agentURL + "<br />");
I looked at our instance and found this property does not exist, but we had one called ' glide.sys.servlet_path '. Funnily enough it doesn't have a value. I replaced
gs.getProperty('glide.servlet.uri') with
gs.getProperty('glide.sys.servlet_path') and the links worked fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 09:00 AM
Hi
Thanks for the solution, it works with gs.getProperty('glide.sys.servlet_path')
I have a question I am trying to user this for my email notification for SLA, but is returning undefined, but the link actually works and it would open in the Agent Workspace.
The email notification for SLA is using the task_sla table that's the only difference between the incidents notification and SLA notifications.
Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 10:23 AM
If you could post you email notification here, we could take a look at it - see where the 'undefined' is coming from, cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 05:46 PM
Hi
Email Script:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
{{// Dynamically construct an Agent Workspace URL and insert a link in the notification
var agentURL = '<a href="' + gs.getProperty('glide.sys.servlet_path') + '/now/workspace/agent/record/'+ current.getTableName() + '/' + current.sys_id + '">' + current.number + '</a>';
template.print(agentURL + "<br />");}}
})(current, template, email, email_action, event);
Email Notification: