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.

To debug the client callable script include

rishabh31
Mega Sage

Team, 

I want to check what came in logs in script include

Script Include:

 

 

var itemUtils = Class.create();
itemUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
	getEntitlements: function() {
		var code = this.getParameter('sysparm_code');
		var result = [];
		var entGr = new GlideRecord('u_code_entitlements'); //Custom 'Organization Job Code Entitlements' Table
		entGr.addQuery('u_job_code', code.toString()); //'u_job_code' is Reference type field; Reference from custom 'Organization Job Code Entitlements' table       
		entGr.addQuery('u_entitlement_active', 'true'); //True/False type field
		entGr.query();
		while (entGr.next()) {
			result.push(entGr.sys_id.toString());
		}
		return result.toString();
	},
	type: 'itemUtils'
});

 

 

 

 

1 ACCEPTED SOLUTION

Prince Arora
Tera Sage

@rishabh31 

 

Please add logs as highlighted in below script and trace these logs in

Filter Navigator <-> system logs

 

 

var itemUtils = Class.create();
itemUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getEntitlements: function() {
var code = this.getParameter('sysparm_code');
gs.info("Risabh: 1" + this.getParameter('sysparm_code'));
var result = [];
var entGr = new GlideRecord('u_code_entitlements'); //Custom 'Organization Job Code Entitlements' Table
entGr.addQuery('u_job_code', code.toString()); //'u_job_code' is Reference type field; Reference from custom 'Organization Job Code Entitlements' table
entGr.addQuery('u_entitlement_active', 'true'); //True/False type field
entGr.query();
while (entGr.next()) {
result.push(entGr.sys_id.toString());
}
gs.info("Risabh: 2" + result);
return result.toString();
},
type: 'itemUtils'
});

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact. 

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Prince Arora
Tera Sage

@rishabh31 

 

Please add logs as highlighted in below script and trace these logs in

Filter Navigator <-> system logs

 

 

var itemUtils = Class.create();
itemUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getEntitlements: function() {
var code = this.getParameter('sysparm_code');
gs.info("Risabh: 1" + this.getParameter('sysparm_code'));
var result = [];
var entGr = new GlideRecord('u_code_entitlements'); //Custom 'Organization Job Code Entitlements' Table
entGr.addQuery('u_job_code', code.toString()); //'u_job_code' is Reference type field; Reference from custom 'Organization Job Code Entitlements' table
entGr.addQuery('u_entitlement_active', 'true'); //True/False type field
entGr.query();
while (entGr.next()) {
result.push(entGr.sys_id.toString());
}
gs.info("Risabh: 2" + result);
return result.toString();
},
type: 'itemUtils'
});

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.