- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 12:06 AM
Hi ,
How to Get Name of the instance in Ui action Client Script
Requirement : To Create a Url link for Ui page ( Same code should work in MUltiple Instances (Dynamic Code)).
Below code is not working in Script . ( only works in Background Scripts)
* gs.getProperty('glide.servlet.uri') + gs.generateURL(strTableName, strSysID)
What to do now ??
Kindly Help me in Getting Name of the Instance in Ui action Client Script .
Thankyou .
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 12:38 AM
script include:
var HelloWorld = Class.create();
HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {
helloWorld:function() {
var instanceURL = gs.getProperty('glide.servlet.uri');
return instanceURL;
} ,
type: 'HelloWorld'
});
UI Action client script part:
function onClick(g_form) {
var ga = new GlideAjax('HelloWorld');
ga.addParam('sysparm_name', 'helloWorld');
ga.getXML(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer); }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 12:33 AM
Hi,
Could you try with below line.
gs.getProperty("instance_name");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 05:31 AM
Hi Tarun,
you can use UI action for this find below code
action name-InstanceName
Onclick-f1()
function f1()
{
gsftSubmit(null,g_form.getFormElement(),'InstanceName');
}
if(typeof window =='undefined')
serverSideCode();
function serverSideCode()
{
var instanceName=gs.getProperty('glide.servlet.uri');
gs.addInfoMessage(instanceName);
action.setRedirectURL(current);
}
Please mark correct or helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 03:02 AM - edited 03-19-2025 03:10 AM
way easier than a script include:
var currentURL = this.location.href;
var str = currentURL.split(".")[0].split("//")[1];