Flow duplicating users in a group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2025 06:29 AM - edited 06-24-2025 04:40 AM
Hi,
I've updated my post with screenshots to provide more details
I've created a flow that runs on an approver table when a record is created or updated. If the approver field changes it checks if the approver is in the approver group and if not, adds them.
The issue is if multiple records are updated at the same time, the approver gets added to the group multiple times.
Is there a way to prevent this? I wondered if using a queue would solve the issue? I'm not sure how queues work in SNow.
Flow
Sub flow - checks if user exists in group before adding
Users updated in bulk in list edit view are added multiple times
Thanks,
Clare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2025 06:37 AM
in flow check if the user is already part of that group
If not then only add
If yes then don't add and end the flow.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 05:32 AM
Hi Ankur,
I've updated my post with screenshot to provide further detail. I am already checking if the user is a member of the group before adding them. The issue is where the user is being added for more than 1 record at the same time.
Thanks, Clare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 06:03 AM
out of the box it does allow duplicates.
You can use before insert business rule and handle and abort
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", current.group);
gr.addQuery('user', current.user);
gr.query();
if (gr.hasNext()) {
current.setAbortAction('true');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 06:04 AM
Hi Ankur,
Would this not have the same result as the flow if records are being updated at the same time?
I had started out with a business rule but ran into some issues which I thought was due to the logic being too complex.
Thanks,
Clare