Cancelling transaction Script include not working

ankit_sharma487
Kilo Guru

Hi Team,

 

i am trying to populate some field value from a User record via On Change catalog client script and getting this message in logs

 

Cancelling transaction #67630 /angular.do (cancelled by other transaction) angular.do?sysparm_cancelable=true&sysparm_type=sp_ref_list_data

1 ACCEPTED SOLUTION

@Anurag Tripathi : i checked again found that i was passing the name of method/function wrongly - resolved now

 

thanks

View solution in original post

10 REPLIES 10

hi @Anurag Tripathi , i just posted above

Lets narrow down the issue step by step

firstly, please add a ,on on the script incldue and print ID (parameter value being passed from client)

And remove Json, just return a simple single value on the client and alert it on client.

this way we will check whether the call is complete and you are able to get to user record or not.

 

 

-Anurag

i initially did same 

 

alerts provided response and its confirmed that its taking value from ref_requester and alerting it but

when it makes call to script include it doesnt print in log anything like sys_id of user or name of user / manager and doesnt alert anything in catalog client script rather shows JAVASCRIPT BROWSER ERROR

let me run for one value and try without JSON and revert back

same is happening this time also

 

In native UI also same happening

 

var MWNUserUtils = Class.create();
MWNUserUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {

	getUserDetails: function(){

		var id = this.getParameter("sysparm_id");
		gs.log('ankit-' + id);
		var gr = new GlideRecord("sys_user");
		gr.get(id);

		if (gr.next()) {


			//var dataArray={"manager": gr.getValue('manager'), "location": gr.getValue('location'), "department": gr.getValue('department') };
			//return JSON.stringify(dataArray);
			gs.log('ankit-'+gr.getDisplayValue('manager'));
			return gr.getValue('manager');
		}
		

	},	





	type: 'MWNUserUtils'
});

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
	
	alert(g_form.getValue('ref_requester') ); 
   var ajax = new GlideAjax('MWNUserUtils');
	ajax.addParam('sysparm_name', getUserDetails);
	ajax.addParam('sysparm_id',g_form.getValue('ref_requester') );
	ajax.getXML(getResponse);
	
	function getResponse(response){
		var answer = response.responseXML.documentElement.getAttribute("answer");
		/*var obj= JSON.parse(answer);
		alert("response: " + obj.manager);
		g_form.setValue('ref_location', obj.location);
		g_form.setValue('ref_business_unit', obj.department);
		g_form.setValue('ref_reporting_to', obj.manager);*/
		
		alert(answer);
		g_form.setValue('ref_reporting_to', answer);
	}
   
}