How to get URL of a record from flow designer?

Meghant Rai
Kilo Guru

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.

1 ACCEPTED SOLUTION

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Still no correct, please check my script, remove " '/nav_to.do?" will redirect to homepage not on target record. 

 

 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader