Group Members has groups that no longer exist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 05:32 AM
When I look at the Group Members table, there are groups listed that no longer exist. Is there a way to clean this up?
I don't want to go through them one-by-one to find them. I was trying to do a report but if I choose Group Member as the table, I can't choose Groups as a related table because they don't relate "that way". If I choose Groups as the table, I can then choose Group Members as a related table but this is essentially a left join on Group's table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 09:35 AM
It means, you want to know the group which has been deleted but records exits.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2023 07:19 AM
Yes. The groups show on the Group Members table but they don't actually exist in the Groups table. Because they show up on the Group Members table, they show up in reports built off the Group Members table so those numbers are incorrect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:12 AM
Hi @Robert Campbell ,
Create a report based on the sys_user_group table:
Chose "group members" as the related list conditions
Remember to set "equal to 0" in selected table
This will give you an overview of the groups that doesn't have any users in the related list.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 07:12 AM
I use a similar report to show where the groups have no members but in this scenario, I need to find the groups that don't actually exist. There is a record of the group in the Group Members table but that group no longer exists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 06:35 AM
Hello @Robert Campbell ,
as per my understanding, it is beacause of when you are deleting groups from sys_user_group table. It is not deleting related record or mybe some another process/flow/script is running in background which is creating this records in your instance.
But it should delete the all related records for example roles, users sub-groups etc.
As it is not doing that in this case. And you want to clear this type of record for sys_user_grmember table. You can run a fix script for cleanup as follow:
// Instead of empty sys_id of group field, please try null, undefined as well. I am not sure about what will work for you.
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', '');
gr.query();
while(gr.next()){
gr.deleteMultiple();
}
Kindly mark my answer as Correct and helpful based on the Impact.
Regards,
Siddhesh