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

getDisplayValue return nothing

Nico12
Mega Sage

Hi,

 

I have a Business Rule on sysapproval_approver.

 

Im trying to return in the logs the display value of the "sysapproval" field, but it return nothing.

var approvers = [];
	var getApprovers = new GlideRecord('sysapproval_approver');
	getApprovers.addQuery('sysapproval', current.sysapproval);
	getApprovers.addQuery('state','requested'); //only show pending approvals
	getApprovers.query();
	while(getApprovers.next()){
		approvers.push(getApprovers.approver.toString());
		var taskValue = getApprovers.getDisplayValue('sysapproval');
		gs.log('DOC ID : ' + taskValue, "NJA");
	}

	if(taskValue.indexOf('REQ') > -1){
		var getRitm = new GlideRecord('sc_req_item');
		getRitm.addQuery('request',current.sysapproval);
		getRitm.query();
		while(getRitm.next()){
			getRitm.u_approvers = '';
			getRitm.u_approvers = approvers.toString();
			getRitm.update();
		}
	}

 

Logs :

Capture.PNG

 

Regards,

5 REPLIES 5

Bert_c1
Kilo Patron

Hi Nico12,

 

My comment is on the use of "getDisplayValue()" in your script.  In my PDI, the 'document_id' field on 'sysapproval_approver' table has "Display" set to 'true'.

 

add 'gs.info()' messages to display script variables at meaningful points in your code to debug.  Maybe you can use the Script Debugger, from the business rule form in the Advanced section. I hope you find your solution.