Dynamic instance URL in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2022 10:01 AM
I have a client script that I need to get the instance for the URL in order to generate the URL for a catalog item to shown. Because I am in a client script I can not use gs.getProperty('glide.servlet.uri'). Is the only way to get the URL is through the use a client script and script include (AJAX)?
For example; I need to get "https://dev58970.service-now.com/" depending on the environment that I am. Like development, UAT or production.
Your expert advise or guidance will be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2022 10:04 AM
Yes use AJAX to retrieve sys_properties client side.
This post shows an alternative method, using BR to set the scratchpad value and client script to get the scratchpad value. But I would recommend just going the AJAX route.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2023 07:59 AM
If you are in Catalog Client Script, you may be able to use one of the following:
this.location.href
this.location.origin