Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

AbstractAjaxProcessor undefined, maybe missing global qualifier

Ebe
Giga Contributor

Hi Team,

I am developing a custom application in my personal dev instance. I am trying to invoke script include in client script and while doing I am facing AbstractAjaxProcessor error. I have verified API name to match in both the scripts and to call right function name. 

Client Script

function onSubmit(){
	if (g_form.getValue('first_name') == '' || g_form.getValue('last_name') == ''){
		g_form.addErrorMessage('First and Last name cannot be empty!');
		return false;
	}	
	
	var ga = new GlideAjax('SZAPICall');
	ga.addParam('sysparm_name','loadData');
	ga.addParam('sysparm_first_name',g_form.getValue('first_name'));
	ga.addParam('sysparm_last_name',g_form.getValue('last_name'));
	alert('before getXML');
	ga.getXML(JSONParse);
	alert('after getXML');
	function JSONParse(response) {
     var answer = response.responseXML.documentElement.getAttribute("answer");
     alert(answer);
	}
}

Scirpt Include

var SZAPICall= Class.create();
SZAPICall.prototype = Object.extendsObject(AbstractAjaxProcessor,{
	loadData:function(){
		alert('inside script include');
		return this.getParameter('sysparm_first_name')+"|"+this.getParameter('sysparm_last_name');
},
    type: 'SZAPICall',
	isPublic: true
});

 

I am getting below error upon form submission

find_real_file.png

Can someone please let me know what is going wrong in this approach?

Thanks

1 ACCEPTED SOLUTION

The SN Nerd
Giga Sage
Giga Sage

You are missing a "global" prefix.
When extending a global Script Include from a Scoped Script, you must prefix with global.

SZAPICall.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

View solution in original post

5 REPLIES 5

The SN Nerd
Giga Sage
Giga Sage

You are missing a "global" prefix.
When extending a global Script Include from a Scoped Script, you must prefix with global.

SZAPICall.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Ebe
Giga Contributor

Thanks Paul, I didn't know about this. This fixed the error, however loadData function is not called. Is there a different way to call this function from scoped to global script?

You don't need alert in script include (server side code).

alert('inside script include');

True, I have removed it and now I see the script include code got executed. Thanks guys!