- 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 10:08 PM
Hi,
Glad to know that my script worked for generating the URL.
You just need to add target attribute with _blank to open in new tab/window
var url = '[code]<a target="_blank" href="' + gs.getProperty('glide.servlet.uri') + '/nav_to.do?uri=' + tableName + '.do?sys_id=' + sysId + '">' + 'My Record' + '</a>[/code]';
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 10:25 PM
Still no correct, please check my script, remove " '/nav_to.do?" will redirect to homepage not on target record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 10:39 PM
Hi,
yes nav_to_do can be removed as per your comment and that is correct.
But I believe as per the question asked it was about generating/showing link in work notes and redirecting on click so approach was shared as per that.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader