Hyperlink in fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi
I want to populate the short description,work notes with ServiceNow | INC00001(as hyperlink such that when i click on it should take to record of that incident).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Vedavalli
To populate Short Description and Work Notes with a hyperlink to an Incident (e.g., INC00001), use the script below.
ServiceNow URLs require the sys_id of the record, so first retrieve it using GlideRecord, then construct the link dynamically.
Business Rule Example:
(function executeRule(current, previous) {
var incidentNumber = 'INC00001';
var gr = new GlideRecord('incident');
if (gr.get('number', incidentNumber)) {
var sysId = gr.getValue('sys_id');
var instanceURL = gs.getProperty('glide.servlet.uri');
var link = '<a href="' + instanceURL +
'nav_to.do?uri=incident.do?sys_id=' + sysId +
'" target="_blank">' + incidentNumber + '</a>';
current.short_description = 'Issue related to ' + link;
current.work_notes = 'Refer to incident ' + link;
}
})(current, previous);
Notes:
- Do not use current.update() inside a Before Business Rule.
- Journal fields (like Work Notes) may strip HTML depending on instance configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Full Example (Business Rule)
You can use this inside a Business Rule:
var incidentNumber = 'INC00001';
var gr = new GlideRecord('incident');
if (gr.get('number', incidentNumber)) {
var sysId = gr.getValue('sys_id');
var instanceURL = gs.getProperty('glide.servlet.uri');
var link = '<a href="' + instanceURL +
'nav_to.do?uri=incident.do?sys_id=' + sysId +
'" target="_blank">' + incidentNumber + '</a>';
current.short_description = 'Issue related to ' + link;
current.work_notes = 'Refer to incident ' + link;
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Vedavalli
Short Description is a plain text field, so you cannot show a hyperlink in it.
If you create any HTML type Custom description field , there you can populate hyper link.
Also to Add hyperlink in Worknote/comment (Journal field), you need to use [code] [/code] tag to insert hyperlink in worknotes and comments.
You can add following code snippet to the existing BR which is creating incident to include the hyperlink :
Sample Code:
current.work_notes = 'Incident [code]<a href="'+gs.getProperty('glide.servlet.uri')+'nav_to.do?uri=incident.do?sys_id='+sysID+'" target="_blank">INC Number </a>[/code] has been created.';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
short description is string field -> so not possible to add hyperlink in that
It's OOTB limitation
You can add link in work notes journal field by wrapping the html in [code][/code] tag
Something like this in before business rule
var sysID = ''; // sysId of your incident
current.work_notes = 'Click your Incident [code]<a href="' + gs.getProperty('glide.servlet.uri') + 'nav_to.do?uri=incident.do?sys_id=' + sysID + '" target="_blank">INC00001</a>[/code]';
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader

