getDisplayValue return nothing
- 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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 09:40 AM
Hi!
I believe there may be two (maybe more) reasons for this:
- The display column is not set on the tasks you are searching for
- The approval has been created for a task than no longer exists
Can you log as well the sysapproval field value and check if it matches any of the above?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 12:16 PM - edited 11-02-2022 12:19 PM
Hi Pedro,
The sysapproval field value return the sys_id of the REQ that im looking for.
For my condition, i need the display value of the REQ (ex: REQXXXX).
the "approval for" (sysapproval) column :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 01:28 PM
Hi, according to the documentation:
there is no argument to be passed in to the method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2022 02:09 PM
Hi Bert_c1,
Well when it's a RITM thats is created from a single item everything is ok, the display value works fine. But when it's a REQ (From Order guide) it return nothing