- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2022 11:01 AM
Hi,
I am trying to empty a list type field value in a business rule but gr.fieldname = ''; doesn't seems to work.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var approvers = [];
var getApprovers = new GlideRecord('sysapproval_approver');
getApprovers.addEncodedQuery('source_table=sc_req_item^state=requested^sysapproval=' +current.sysapproval); //only show pending approvals on sc_request and sc_req_item tables
getApprovers.query();
while(getApprovers.next()){
approvers.push(getApprovers.approver.toString());
var taskValue = getApprovers.getValue('sysapproval');
var getRitm = new GlideRecord('sc_req_item');
//getRitm.addQuery('request',current.sysapproval);
getRitm.addQuery('sys_id', taskValue);
getRitm.query();
if(getRitm.next()){
getRitm.u_approvers = '';
getRitm.u_approvers = approvers.toString();
getRitm.update();
}
}
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2022 11:22 AM
Hi,
Try using
getRitm.setValue('u_approvers', '');
Although, you are just setting new values to the list field, you donot need to explicitly empty the field, just remove this line from the above script:
getRitm.u_approvers = '';
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2022 11:22 AM
Hi,
Try using
getRitm.setValue('u_approvers', '');
Although, you are just setting new values to the list field, you donot need to explicitly empty the field, just remove this line from the above script:
getRitm.u_approvers = '';
Aman Kumar