How to prevent duplicate records in sys_user_grmember?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
We are seeing duplicate records in the sys,user,grmember table where the same user is added to the same group multiple times. This usually happens due to automated scripts, Flow Designer actions, or integrations that add group members without checking existing membership first.
What is the recommended best practice in ServiceNow to prevent these duplicate user and group records from being created?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Greetings @AyushK859766811. My initial thought was to do a Business Rule on the Group Member table [sys_user_grmember] using a simple GlideRecord query that adds Query conditions for the Group and User values from the current record and then utilizes a .hasNext() method to abort the action. However, when I went to test this Business Rule in my Personal Development Instance (PDI), I wasn't able to recreate a duplicate entry on the Group Member table without the need of any new Business Rule.
I tried using a Background Script to do a GlideRecord insert in addition to navigating to the Group Member table and clicking the New button.