We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

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

Hi,

this line should give you the URL in server side

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

Regards
Ankur

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

View solution in original post

10 REPLIES 10

Ankur Bawiskar
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  ||  ✨ 10x 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  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar Inside View