- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 12:13 PM - edited 03-01-2023 12:31 PM
Hello experts, please I need your help, I'm creating a BR that removes inactive users from a watchlist, this is what I have and I found out something, if the watchlist has mre than one user, this does not work, this works when there is just a single user =( what do I need to modify as well?
This is working when I have the user just in "Watch list", how can I add another condition to check another field called: Worknotes list
how can I add another condition to remove the user from Worknotes watch list too? I tried:
but it is not working, what am I doing wrong?
I need to add 2 more custom watchlists, so I will need to add a total of 4 conditions to remove the inactive users from those 4 watch lists once the other 2 are created, could you please guide me?
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 01:19 PM - edited 03-01-2023 02:02 PM
Hi,
Thanks. So you'd need to take the current watch_list and make it into an array and if they're found, remove them, and then set the watch_list to the final value (could be none or could be all the other names still there but the inactive user is removed).
So something like:
var array = tsks.watch_list.toString().split(',');
if (array.indexOf(current.getValue('sys_id')) > -1) {
var index = array.indexOf(current.getValue('sys_id'));
array.splice(index, 1);
tsks.watch_list = array;
}
var array2 = tsks.work_notes_list.toString().split(',');
if (array2.indexOf(current.getValue('sys_id')) > -1) {
var index2 = array2.indexOf(current.getValue('sys_id'));
array2.splice(index2, 1);
tsks.work_notes_list = array2;
}
tsks.update();
The above is an example to add to your code after the while(tsks.next()) { line.
Please follow similar format array3, array4, etc. as you need. There are other ways to do this, but I've provided one example. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 01:36 PM
Thank you Allen!
Warm Regards