How to get the list of records that got removed from list field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 04:16 AM - edited ‎11-07-2022 04:28 AM
i have a list field called managers referencing to sys_user table.
So whenever the user gets removed from the manager field, I need to set another field as false.
But for this how can i get the list of all users that is removed from the manager list field.
How to write a Br to get the list of all users that is removed from the list field manager.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 06:22 AM
In a before Update Business Rule, you can use the previous object. Combined with the ArrayUtil methods, you can easily get a list of records removed from the List field like this:
(function executeRule(current, previous /*null when async*/) {
prevArr = previous.u_managers.split(',');
curArr = current.u_managers.split(',');
var arrayUtil = new global.ArrayUtil();
var delArr = arrayUtil.diff(prevArr, curArr);
gs.addInfoMessage('del=' + delArr)
})(current, previous);