GlideAjax / application scopes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 06:14 AM
Hi everyone !
I'm actually facing an issue, I really can't understand : I'm trying to call a script include with Glide Ajax, but it doesn't work... I'm in a catalog client script, set in Customer Service application scope, which calls a script include, in global application, set on Accessible for all.
To make it simplier to analyse, my script include just returns "test" value :
My catalog client script (CustomerService application) :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('global.Test');
ga.addParam('sysparm_name', 'testMethod');
ga.getXML(function(response) {
var test = response.responseXML.documentElement.getAttribute("answer");
alert("test " + test);
});
}
My script include (global and accessible from All application scope) :
var Test = Class.create();
Test.prototype = Object.extendsObject(AbstractAjaxProcessor, {
testMethod : function() {
return "test";
},
type: 'Test'
});
My alert message, in my callback function, returns ... null...
Could anyone explain me what's happening ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 06:46 AM
It should work:
Try changing your client script to:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('global.Test');
ga.addParam('sysparm_name', 'testMethod');
ga.getXML(callBack);
function callBack(response){
var test = response.responseXML.documentElement.getAttribute("answer");
alert("test " + test);
});
}
For more details, feel free to explore:
https://community.servicenow.com/community?id=community_blog&sys_id=788c66e1dbd0dbc01dcaf3231f961969
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 07:35 AM
Hi,
Thanks for your answer, but it doesn't work 😞
I had implemented like this at beginning of my tests.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 06:53 AM
Hi,
that means script include is not getting called
Is script include client callable?
share your screenshots for both the configurations script include and client script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2022 07:37 AM
Yes, it is client callable.
To be sure it's all right, I've made an insert&stay on a OOB script include, which I was able to make work.
But unable to call the copy, whereas the OOB works 😞