- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 06:55 AM
Hi fellow service-now developers,
I am trying to call a "Script Include" from a "Client script", but I cannot make it works.
Client script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('VdlAddressUtils');
ga.addParam('sysparm_name', 'hasIdGDA');
ga.getXML(getResponse);
function getResponse(response) {
var res = response.responseXML.documentElement.getAttribute("answer");
alert(res)
}
}
Script include:
var VdlAddressUtils = Class.create();
VdlAddressUtils.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
hasIdGDA: function() {
return "1";
},
type: 'VdlAddressUtils'
});
Do you know why?
PS: My script include is accessible remotely.
PS2: My alert shows a "Null".
Edit: After the suggestion of
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 08:54 AM
Ok, got it guys.
I had a "gs.log("!!!HERE!!");" into my script include, and that causes my issue.
Thank you all!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 07:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 08:57 AM
Feel free to mark helpful, if it assisted you
Thanks!
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 07:43 AM
Hi,
try to use this syntax
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('VdlAddressUtils');
ga.addParam('sysparm_name', 'hasIdGDA');
ga.getXMLAnswer(function(answer){
alert(answer);
});
}
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-11-2022 07:51 AM
Hello! Thanks for the answer, but now my alert now shows: "[object XMLHttpRequest]"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 08:07 AM