Workspace Declarative Action || Get URL in server script

JagjeetSingh
Kilo Sage
Kilo Sage

Hi,

I am trying to access the current URL in my list declarative action.

Tried various methods in my server script to get the URL but none works.

gs.action.getGlideURI() returns "api/now/v1/batch?api=api" 

Any idea?

@Ashley Snyder : I've gone through your articles on workspace. They are BIG help! I'd appreciate your comments on this one.

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023
3 REPLIES 3

r_gissarl_
Mega Expert

Hello Jagjeet,

 

Server side, if you are not working with a GlideRecord, you can get the instance URL with :

gs.getProperty('glide.servlet.uri');

Then you can add your URI with :

gs.getProperty('glide.servlet.uri') + gs.action.getGlideURI();

 

If you work with a GlideRecord, you can get the link with (where gr is your GlideRecord) :

gs.getProperty('glide.servlet.uri') + gr.getLink();

 

Regards.

These does not return the URL in proper format again.

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

JagjeetSingh
Kilo Sage
Kilo Sage

I actually ended up having a custom page in UI builder and then worked with page parameters to get my requirement done.

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023