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

Prasad Pagar
Mega Sage

Hi @Balaraju K B 

I read the conversion between you and Ankur. As you are in Custom Scope

Can you try to add below Cross scope in system and then use 

gs.action.getGlideURI().toString();

1. Mention your scope instead of Prasad

find_real_file.png

2.

find_real_file.png

Let me know if it works

Thank you
Prasad