Unable to call Ajax Script Include

Akihisa Abe
Tera Expert

Hello.

I get an error with "Glide Ajax" in a scoped application. It was output as follows in the system log.

(I got this error in the service portal, but not in UI16.)


”Script: AjaxTest not found in scope: global, and HTTP Processor class not found: com.glide.processors.xml http.AjaxTest: no thrown error”

Do script includes have to be created globally even in scoped applications?
I would like to know how to avoid this error.

 

【Code where the error occurred】

function onCondition() {	
	var dData = [];
	var ajax = new GlideAjax('AjaxTest');//An error occurred here
	ajax.addParam('sysparm_name', 'getJson'); 
	ajax.getXMLAnswer(function(answer) { 
		dData = JSON.parse(answer).array;
	});
}

find_real_file.png

【Scope etc.】

find_real_file.png

find_real_file.png

find_real_file.png

Thanks.

1 ACCEPTED SOLUTION

Sourabh26
Giga Guru

Hi,

 

It seems that both your script and UI policy are in same scope "TEST_APP" which is correct. But when you called your script include using Ajax call you simply defines script include name only.

 

For custom calls you need to use the API namespace, replace your code as below.

var ajax = new GlideAjax('x_******AjaxTest');//API name

 

Note: Also check in script include accessible from "this application scope" to "All" if you have any issue.

 

Mark this as Helpful/Correct, if Applicable.

 

Regards,

Sourabh

 

View solution in original post

7 REPLIES 7

I guess Maybe it's because there's a script include with the same name in your environment

Sourabh26
Giga Guru

Hi,

 

It seems that both your script and UI policy are in same scope "TEST_APP" which is correct. But when you called your script include using Ajax call you simply defines script include name only.

 

For custom calls you need to use the API namespace, replace your code as below.

var ajax = new GlideAjax('x_******AjaxTest');//API name

 

Note: Also check in script include accessible from "this application scope" to "All" if you have any issue.

 

Mark this as Helpful/Correct, if Applicable.

 

Regards,

Sourabh

 

Akihisa Abe
Tera Expert

I changed the problem part as follows and changed the "accessible from" of the script include to all, and it was solved.

var ajax = new GlideAjax ('x_794558_test_app.AjaxTest');

Thank you very much. It was helpful.