The CreatorCon Call for Content is officially open! Get started here.

How to call script include from UI Page client script section ?

fisfreak
Kilo Contributor

Hello,

I need to make a call to script include from UI Page, when i try to invoke a function from client script of UI Page, it is not returning me anything, where as same thing works from catalog client script. please find the code snippet below.

$(document).ready(function() {
	var ga = new GlideAjax("ControlVirtualMachinesAjax");
	ga.addParam("sysparm_name", "getVMSInRG");
	ga.getXML(ajaxResponse);
	
	function ajaxResponse(serverResponse) {
		alert("ServerResponse: " + serverResponse);
		
		}	

});

						

Same code works perfect from catalog client script but not from client script of UI Page. In the above code , control never comes inside ajaxResponse method.

Thanks,

Krishna P

 

20 REPLIES 20

Go to script includes and search for ControlVirtualMachinesAjax record. On the record, you can see Client callable checkbox.

Hi,

Make sure your script include is returning the value.

CLient callable is checked and its accessible from all application scope.(if you are using some different scope)

find_real_file.png

This is my script include screen shot. client callable options are enabled.

I do not see any difference

find_real_file.png

Is your UI page in same application scope i.e. x_fisg2_scope.

If not, please change the accessible from value to all application scope.

 

Thanks

Gaurav

 

yes, my UI page is in the same scope as script include. and i have tried changing the accessible from value to All application scope, but none worked.

find_real_file.png

 

script include scope is  - x_fisg2_scope.ControlVirtualMachinesAjax

up page endpoint is - x_fisg2_scope_VM List Page.do