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

panda1
Kilo Guru

Where is your script include,and Where is your script include client script

in global or scope?

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so your script include is global or custom scope?

ui policy is in which scope?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Akihisa Abe
Tera Expert

thank you for your reply.
Script include is set to custom scope.
Added the setting such as scope to the question text.

Hi,

if script include and ui policy are in same scope then you can just use name of the script include

Can you share the complete script and script include configuration screenshot

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader