- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2022 06:51 AM
Hi,
We have a ui action in List context menu, and need to access the current URL for a requirement. Is there any OOB script to fetch the current URL in UI action. Please help.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2022 07:11 AM
Hi there,
This code should work for any server-side script (including UI Actions) to get the current URL:
gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI();
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2022 08:37 AM
Sure so you could use the below code to get your sysparm variable value:
var url = "alm_hardware_list.do?sysparm_query=u_hardware_type%3DMonitor%5Einstall_status%3D6%5Esubstatus%3Davailable&sysparm_rit=1251182f1b124990f576dd31b24bcbfc&sysparm_first_row=1&sysparm_view=";
gs.info(getParameterValue('sysparm_rit'));
function getParameterValue(name) {
name = name.replace(/[[]/, "\\[").replace(/[\]]/, "\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(url);
return (results ? unescape(results[1]) : "");
}
Result:
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2024 03:51 PM
What's the Configurable Workspace solution for this?
gs.action.getGlideURI() doesn't work, and *.location.href only works client side.