getDisplayValue return nothing
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 09:12 AM
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 :
Regards,
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 03:15 PM
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.