- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2018 05:23 PM
I am trying to write a catalog item client script displaying a message with the users domain.
I have tried many different script ideas over 10 hours but nothing I have tried works with Catalog client scripts.
How can I Call user domain in a catalog client script?
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2018 08:27 PM
i would suggest here, use display business rule and then you can call that variable in your onLoad() client script to get the value.
or if you want in onChange() client script , use glide ajax.
Sample Script:
Display Business rule:
var myUser = gs.getUser();
g_scratchpad.domain_id = myUser.getDomainID();
g_scratchpad.domain_display_value = myUser.getDomainDisplayValue();
OnLoad Client SCript:
alert(g_scratchpad.domain_id);
Another Approach: Using Glide Ajax.
Client Script: onChange()
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);
}
Script Include( make sure you mark "Client Callable" true.
var HelloWorld = Class.create();
HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {
helloWorld:function() {
var myUser = gs.getUser();
var userDom = myUser.getDomainID(); // if you want id then you can pass "userDom" variable in return.
var userDomValue= myUser.getDomainDisplayValue();
return userDomValue ;
},
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2018 09:15 AM
No luck with Business Rule and onLoad Client script...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2018 07:55 PM
can you share the screenshot?
what is coming in business rule log? i had mentioned two solutions, both did not work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2018 08:31 AM
No success with business rule & client script.
I have no Glide Ajax experience; so I am reaching out on my team to find solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2021 10:17 PM
If so, can you please guide me as to how I would do that.
Thank you,
Ayshee Chattopadhyay