Skip to content

Commit 4218246

Browse files
committed
improved read me
1 parent ef1d3fd commit 4218246

File tree

1 file changed

+16
-2
lines changed
  • Server-Side Components/Background Scripts/Fetch Active Groups list without members

1 file changed

+16
-2
lines changed
Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
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

0 commit comments

Comments
 (0)