File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Server-Side Components/Background Scripts/Fetch Active Groups list without members Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 1- Sample code to clean up the Groups with no members.
2- This code help to get the Active groups list with no members
1+ A background script that identifies and returns all active groups in ServiceNow that have no members assigned to them.
2+
3+ ## What It Does
4+
5+ The script:
6+ 1 . Queries all active groups in the ` sys_user_group ` table
7+ 2 . For each group, checks the ` sys_user_grmember ` table for member count
8+ 3 . Uses GlideAggregate to efficiently count members per group
9+ 4 . Collects group names (or sys_ids) that have zero members
10+ 5 . Outputs the complete list of empty groups to the system log
11+
12+ ## Configuration Options
13+
14+ - ** Group names vs IDs** : Uncomment line 21 to collect group sys_ids instead of names
15+ - ** Limit results** : Uncomment line 6 to limit the query to 1500 groups for large instances
16+ - ** Additional filtering** : Modify the encoded query on line 3 to add specific group criteria
You can’t perform that action at this time.
0 commit comments