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
Greetings @AlwinJebakY. Would you be able to share your code here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @AlwinJebakY ,
Please share the code so I can review it.
Apart from that, you can also try this:
The issue is that the function you are calling is not inside the Script Include’s prototype. GlideAjax only executes functions that are defined inside the prototype block.
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and "Helpful."
This action supports both the community and me.
Regards
Raj Shinde
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
HI @rajshinde999910 & @lpruit2
Script Include :
var PidUpdateDetails = Class.create();
PidUpdateDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkUserGroup: function(){
if(gs.getUser().isMemberOf('73c0dc793bd87210543085ae53e45a04')){
gs.log('User having Group');
return true;
}else{
gs.log('User Not Having Group');
false;
}
},
type: 'PidUpdateDetails'
});Client Script:
var ga = new GlideAjax("sn_customerservice.PidUpdateDetails");
ga.addParam("sysparm_name", "checkUserGroup");
ga.getXMLAnswer(function(response) {
Console.log(response);
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
gs.log() is breaking the code
use gs.info()
Update as this
💡 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