Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

Removing that alert() line should fix it up.


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