- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2023 12:13 AM
Hello Everyone,
After the upgrade of the version i noticed empty groups being added into a user profile which on expanding gives me sys_ids or alphanumeric numbers.
I want to fix this issue using backgroud or fix scripts.
Can somebody guide me?
i need to remove these in the red box via script for all the users.
Thank you in Advance,
Renu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2023 02:09 AM
Well, the memberships themselves are stored in "sys_user_grmember" table.
You could do a query there and delete the extras. Here's a script that you can try first:
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery("group.nameISEMPTY");
grMember.query();
gs.info("Amount of unnamed groups: " + grMember.getRowCount());
//grMember.deleteMultiple();
Run this script in background and if the log text shows the same amount of rows as there are these incorrect group memberships, then you can uncomment the grMember.deleteMultiple(); and run it again to delete all those memberships.
Note that it might be a good idea to also add a grMember.setLimit(10) before the grMember.query() to test this out first with 10 records. You probably want to avoid deleting everything accidentally.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2023 02:09 AM
Well, the memberships themselves are stored in "sys_user_grmember" table.
You could do a query there and delete the extras. Here's a script that you can try first:
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery("group.nameISEMPTY");
grMember.query();
gs.info("Amount of unnamed groups: " + grMember.getRowCount());
//grMember.deleteMultiple();
Run this script in background and if the log text shows the same amount of rows as there are these incorrect group memberships, then you can uncomment the grMember.deleteMultiple(); and run it again to delete all those memberships.
Note that it might be a good idea to also add a grMember.setLimit(10) before the grMember.query() to test this out first with 10 records. You probably want to avoid deleting everything accidentally.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2023 02:13 AM
that related list table is for sys_user_group or sys_user_grmember
I believe it's for sys_user_grmember.
Also I believe the groups you are showing must be having name field as empty in their record. please check that
For sys_user_grmember there is no field marked as Display=true so in 2nd screenshot you are seeing sysIds.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader