Set multiple sys_id's to glide_list field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 10:08 AM
Hi,
I need to push multiple values to a glide list field. Currently it's only pushing one sys_id and I'm not sure how to push all values from the gliderecord record. Script below:
(function executeRule(current, previous /*null when async*/ ) {
var entList = [];
var m2moim = new GlideRecord('x_lbg_insider_risk_insider_access_lookup');
m2moim.addQuery('sys_id', current.ir_access_categorisation);
m2moim.query();
while (m2moim.next()) {
entList.push(current.getValue('sys_id'));
m2moim.u_oim_entitlements = entList.join(',');
m2moim.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 10:41 AM
Hi,
Try writing that join() method line outside the while loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 10:52 AM
Or try below while loop code:
while (m2moim.next()) {
entList.push(m2moim.getValue('sys_id'));
}
current.u_oim_entitlements = entList.join(',');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 03:40 PM
Thanks Onkar. Still not working unfortunately. Doing it that way doesn't pass anything into the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 11:05 AM
Thanks Onkar. I think the problem here is that I'm not returning the correct sys_id's. If I add 4 entitlements on my m2m table here:
My log returns 4 entries, but it's the sys_id of that record they sit on 4 times, rather than the 4 different sys_id's of the entitlements above. Hope that makes sense. My query needs to return those 4 sys_ids above and push to glide list field. Can you help?