Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get URL in server side code

Balaraju K B
Tera Expert

Hi Team,

I'm having two views let's say 'x' and 'y'.

if the page I'm opening is portal then I want to force view x and if it's standard UI (backend) then I wanted to show view y.

For this to happen I'm writing a script in the view there I want to get the URL of the standard UI in the server side code??

@Ankur Bawiskar How can I achieve this requirement any thoughts??

Thanks In Advance,

Balaraju KB

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

this line should give you the URL in server side

var url = gs.action.getGlideURI().toString();

Regards
Ankur

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

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

this line should give you the URL in server side

var url = gs.action.getGlideURI().toString();

Regards
Ankur

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

@Ankur Bawiskar I have tried the above method it's giving me the portal URL but for Standard UI it's not working

Hi,

where are you using this script?

Regards
Ankur

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

@Ankur Bawiskar Inside View