How to get current URL from UI action

saranyavs
Tera Expert

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.

1 ACCEPTED SOLUTION

chrisperry
Giga Sage

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

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

View solution in original post

6 REPLIES 6

chrisperry
Giga Sage

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

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

Thank you, its working...

Also is there any way to get a particular sysparm variable from current Url that we fetched?

Could you please share the URL and which sysparm variable you are trying to fetch?

Regards,

Christopher Perry

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

"alm_hardware_list.do?sysparm_query=u_hardware_type%3DMonitor%5Einstall_status%3D6%5Esubstatus%3Davailable&sysparm_rit=1251182f1b124990f576dd31b24bcbfc&sysparm_first_row=1&sysparm_view="

This is a sample URL and we need to fetch sysparm_ritm , is a sys_id.