Hi @Michael Fleet,
You can use below JavaScript code to achieve that:
const rith_grpBMem = [
{ id: '68rithwik2739fc7c', name: 'Rithwik User' },
{ id: '48testb5717de', name: 'Bojja User1' },
{ id: 'e9ce96emoc29af837', name: 'Chotu User2' }
];
const rith_grpCMem = [
{ id: '48testb5717de', name: 'Bojja User1' }
];
const choIds = new Set(rith_grpCMem.map(u => u.id));
const usersToAddToGroupA = rith_grpBMem.filter(u => !choIds.has(u.id));
return usersToAddToGroupA;
Here, I have taken hardcoded groups. You can replace it with yours.
Output:
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.