- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 04:45 AM
I have a requirement where I have to mention the incident number in worknotes/Additional comments section in form of Hyperlink.
I can do it via [code]<a href="https://www.servicenow.com">ServiceNow.com</a>[/code], but the question is how can I get the URL of the incident.
There are no data pills available to fetch URL of incident to re-direct on click.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 06:38 AM
Hi,
so what is pending?
you can get current record sys_id inside the f(x) script like this
var sysId = fd_data.trigger.current.sys_id;
That would help you form the URL to the record
like this; it would add link to current record on which flow is running
var tableName = fd_data.trigger.current.sys_class_name;
var sysId = fd_data.trigger.current.sys_id;
var url = '[code]<a href="' + gs.getProperty('glide.servlet.uri') + '/nav_to.do?uri=' + tableName + '.do?sys_id=' + sysId + '">' + 'My Record' + '</a>[/code]';
return url;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 01:36 PM
Hi Ankur,
It created a hyperlink, however when I try to click it the page again gets re-directed to homepage. Whereas if I try to open link in new tab or new window it is working perfectly.
Any reasons why its not working on normal click?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 01:43 PM
try now, no to do use nav_to.do
eg:
var tableName = fd_data.trigger.current.sys_class_name;
var sysId = fd_data.trigger.current.sys_id;
var url = '[code]<a href="' + gs.getProperty('glide.servlet.uri') + '/' + tableName + '.do?sys_id=' + sysId + '">' + 'My Record' + '</a>[/code]';
return url;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 01:48 PM
To open in new window, please try with below updated script:
var tableName = fd_data.trigger.current.sys_class_name;
var sysId = fd_data.trigger.current.sys_id;
var url = '[code]<a href="' + gs.getProperty('glide.servlet.uri') + '/' + tableName + '.do?sys_id=' + sysId + '"target="_blank">' + 'My Record' + '</a>[/code]';
return url;
Note: I have tested and working fine in my personal instance.
If my answer helped you, kindly mark it as correct and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 01:53 PM
It worked

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 01:57 PM
Glad it worked.
Did you accidently mark other answer as correct? kindly select the correct answer and working script.
If my answer helped you, kindly mark it as correct and helpful.