- 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
‎08-10-2020 06:01 PM
Hi
I found my error , in the last line I need to write current.task.number instead of current.number
Now is showing up the Incident number
(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 u = URI_REF;
var agentURL = '<a href="' + gs.getProperty('glide.sys.servlet_path') + '/now/workspace/agent/record/' + current.getTableName() + '/' + current.sys_id + '">' + current.task.number + '</a>';
template.print(agentURL + "<br />");