GlideAjax is not executing Script Include method across scope
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I'm facing an issue while calling a Script Include from a Client Script using Glide Ajax.
My Client Script is in the Global Scope
The Script Include is in the Customer Service Scope
Accessible from is already set to All Application Scope
Script Include is marked Client Callable = true
The GlideAjax request is visible, Script Include is getting triggered
But the function inside the Script Include is not executing.
I have already verified the following
Script Include is marked Client Callable = true
Script Include is accessible from all application scopes
In Client Script Correct Script Include name and function name are used
No Console errors
GlideAjax call is firing correctly
Still the Script Include does not executed.
Is there anything else required to call a Script Include from Global Scope When it is created under Customer Service Scope ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Ankur Bawiskar
Still now that function is not executed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
any reason client script and script include are in different scope?
why not keep them both in same scope? then it will work for sure.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Ankur Bawiskar
If we will create Client Script and Server Script in same scope
Then why they will provide Accessible from All Application Scope option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I discovered this problem last week and asked for a few days without any breakthrough. At one point, I suspected it was my own problem. 11 months ago, there was a YouTube video that said it could be done, but it didn't work at all. I asked AI for various solutions, but none of them worked. Servicenow is too closed. It feels like this won't work, that won't work. People who can't code won't use it, and people who can code won't use it either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @AlwinJebakY ,
I tried your problem in my PDI and it works for me
Please check solution below
Client script which is onChange on caller field
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
alert("Called SI");
var ga = new GlideAjax('sn_hr_core.myScriptIncNew');
ga.addParam('sysparm_name', 'callFunc');
ga.getXML(function(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert("Ans = " + answer);
});
}
Script Inc
var myScriptIncNew = Class.create();
myScriptIncNew.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
callFunc: function(){
return "Called SI in Different Scope"
},
type: 'myScriptIncNew'
});
Result
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak