How to make incident number hyper link in notification message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 10:50 PM
In the email notification, make the Incident ticket number a hyperlink to the record on the platform.
how to make hyper link below incident number

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 10:55 PM - edited 09-04-2023 10:56 PM
Hi @sinu2
Use ${URI_REF} instead of ${number}
It will give you a hyperlink with incident number.
To understand how these work, navigate to below link:
Mark the response as helpful & correct if it resolves your issue, so the thread can be close.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 11:17 PM
Hello Sinu,
1. You need to write Notification email script.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,/* Optional GlideRecord */event) {
/*Assuming your notification run on incident table*/
var sysId = current.getValue('sys_id');
template.print('<a href="' + gs.getProperty('glide.servlet.uri') + 'incident.do?&sys_id=' + sysId + '">' + '${number}' + '</a>');
})(current, template, email, email_action, event);
2. Call this mail script in your notification template
incident #: ${mail_script:<"name of your mail script">}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 11:21 PM
Hi
We can use ${URI_REF} and hyperlink would be created for the display field of record which in this case would be Incident number.
Please check below link:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2023 11:29 PM
Hi @sinu2,
You can use ${URI_REF} and it redirects to the Native UI and if you want to redirect it to the workspace view, you need to create a email script for this. Below is a sample.
(function runMailScript(current, template, email, email_action, event) {
// Build the link format
var attachLink = '<a href=/sp?id=ticket&sys_id=' + current.sys_id;
attachLink += '&table=table_name';//Keep the table name here
attachLink += '>here</a>';
// Print the link text
template.print(attachLink);
})(current, template, email, email_action, event);
Mark this answer as correct and helpful if it solves your issue.
Regards,
Siva Jyothi M.