glide.servlet.uri

Chandra31
Tera Contributor

Hi Team,

In my project we are using custom uri's, i just want to compare both the uri's(Prod and DEV) and it should display Production uri. Can anyone suggest me.

Thaks

CSR

 

9 REPLIES 9

Willem
Giga Sage
Giga Sage

You can use the following:

gs.getProperty('glide.servlet.uri') will return the current instance url. For example:

https://yourdevelopmentinstance.service-now.com/

https://yourpoductioninstance.service-now.com/

 

So you can compare like this:

if(gs.getProperty('glide.servlet.uri') == 'https://yourpoductioninstance.service-now.com/'){
    //display prod
}

 

Or check if it contains the production prefix:

if(gs.getProperty('glide.servlet.uri').indexOf('yourpoductioninstance')!=-1){
    //display prod
}

 

Let me know if that answers your question! 🙂

Willem
Giga Sage
Giga Sage

Or use:

gs.getProperty("instance_name")

 

That will only return the prefix. So devxxxx or yourpoductioninstance

 

Then compare it like:

if(gs.getProperty("instance_name") == 'yourpoductioninstance'){
    //display prod
}

 

Chandra31
Tera Contributor

Hi Willem,

 

Thanks for the quick response.

 

Here my ask is 

in my prod having two url's, backend value showing "olprod" and fronend value displaying "csprod".  i wanna display only "Csprod". Please suggest how can i achieve this.

 

Thanks in advance.

What do you mean with "my prod having two url's"? And what do you mean with back end and front end value?

Where do you want to display this?