The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Email Link to Catalog Task in Workspace

Baggies
Kilo Guru

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

 

1 ACCEPTED SOLUTION

Baggies
Kilo Guru

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.

View solution in original post

5 REPLIES 5

Baggies
Kilo Guru

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.

Hi @Baggies 

 

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? 

If you could post you email notification here, we could take a look at it - see where the 'undefined' is coming from, cheers.

Hi @Baggies , 

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: 

find_real_file.png