Instance name or base URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2010 02:35 AM
Hi,
I need to have base url our instance name, because , as we have 3 instances, we cannot hard code links. (I can't find a way to use ${URI} or ${URI+} in blocs in templates)
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2010 05:47 AM
Damn html interpreter :
function CreateLinkForObject(strTableName, strSys_id)
{
return "<a href=\"" gs.getProperty("glide.servlet.uri") + gs.generateURL(strTableName, strSys_id) + "\">LINK</a>";
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2012 08:59 AM
I had to find a way to get this in a client script. This worked for that;
var href = "https://" + window.location.host + "/ess";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2022 03:27 AM
1- From the main developer page, click on your name in top right corner
2- Click on Manage instance password
3- Your URL is there
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 01:48 AM
Sure, you can use the GlideSystem (gs) method 'getProperty' to get the base URL of your instance. Here's how you can do it:
1. Use the gs.getProperty() method to get the 'glide.servlet.uri' property, which holds the base URL of your instance.
javascript
var baseURL = gs.getProperty('glide.servlet.uri');
2. Now, you can use this 'baseURL' variable in your code wherever you need the base URL of your instance.
3. If you want to use this in an email script, you can do it like this:
javascript
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template, /* EmailOutbound */ email, /* GlideRecord */ email_action, /* GlideRecord */ event) {
var baseURL = gs.getProperty('glide.servlet.uri');
template.print(baseURL);
})(current, template, email, email_action, event);
4. If you want to use this in a UI Page or UI Macro, you can do it like this:
xml
gs.getProperty('glide.servlet.uri')
${jvar_baseURL}
5. If you want to use this in a client script, you can do it like this:
javascript
var ga = new GlideAjax('GlobalAJAXProcessor');
ga.addParam('sysparm_name', 'getBaseURL');
ga.getXMLAnswer(function(answer) {
var baseURL = answer;
// use baseURL here
});
And in the 'GlobalAJAXProcessor' script include:
javascript
if (name == 'getBaseURL') {
return gs.getProperty('glide.servlet.uri');
}
Remember, the 'glide.servlet.uri' property should be set correctly in the System Properties for this to work.
nowKB.com
If you want to know any information about Service Now . Visit to https://nowkb.com/home