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-25-2025 06:10 AM
try with business rule and if it still doesn't work then may be we don't have an approach yet.
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 07:07 AM
try using script step in your subflow and use GlideRecord to check if user+group combination already present
var userId = /* your user sys_id */; // pass this as input to subflow
var groupId = /* your group sys_id */; // pass this as input to subflow
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', userId);
gr.addQuery('group', groupId);
gr.query();
if (!gr.hasNext()) {
var newGr = new GlideRecord('sys_user_grmember');
newGr.initialize();
newGr.user = userId;
newGr.group = groupId;
newGr.insert();
}
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-23-2025 06:37 AM
Hi @ClareM ,
You mean to say you are changing the Approver regularly?
Sandeep Dutta
Please mark the answer correct & Helpful, if i could help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2025 05:34 AM
Hi Sandeep,
Yes, the approvers change regularly so we use various tables, cost centre etc. and I created flows to handle the assignment of the approver role.
I've updated my post with screenshots of the flows for further information
Thanks, Clare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2025 06:40 AM
Hello @ClareM ,
Since you haven’t included screenshots or details of the flow setup, it's a bit tricky to give an exact solution—but based on what you described, one thing you can try is adding a check before adding the user to the group.
You can use a "Lookup Record" action on the sys_user_grmember table (that’s where group memberships are stored) and filter it by the user and the group. Use data pills to dynamically pass the approver and the group from your flow data.
Then, wrap your "Add to group" logic inside an "If" condition—only proceed to add the user if the lookup returns no matching records (i.e., the user is not already in the group).
This should help avoid duplicates even when multiple records are being updated around the same time.
If possible, feel free to share a screenshot of your flow setup—happy to take a closer look and suggest more precise tweaks!
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Regards,
Aniket