- 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 06:57 AM
Hi,
Please use the appropriate forum feature: "Insert/Edit code sample" when pasting code on the forums. Currently, your formatting is all off and confusing.
Additionally, please refer to this GlideAjax cheat sheet for a quick summary of how to format things: https://community.servicenow.com/community?id=community_article&sys_id=9f7ce2e1dbd0dbc01dcaf3231f961...
Unfortunately, you haven't told us much as far as any troubleshooting you've done, errors you're seeing, etc.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 06:58 AM
My bad, I just updated it. Didn't expect a response that fast ^^

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 11:17 AM
Hello,
I'm glad my reply above was at least Helpful.
The script you provided showed no logging, which is why I was asking about it above. Now, you've marked your own reply as Correct due to gs.log (which you shouldn't use anyway -- use gs.info()
Oddly, there was quite a bit of responses here...in the future, I hope you provide more information. Thanks!
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 07:08 AM
Hey
Try putting gs.info statement in your function to see if the client script is even calling the Script include also
when you put alert, there is no semi-colon
alert(res);
Aman Kumar