Skip to content

Commit 83f00e8

Browse files
authored
Create README.md
This README explains how to configure and use the fix script.
1 parent 2db414f commit 83f00e8

File tree

1 file changed

+28
-0
lines changed
  • Specialized Areas/Fix scripts/Group Sync Script

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
ServiceNow Fix Script - Group Role Synchronization
2+
Overview
3+
4+
This Fix Script automatically validates and synchronizes user roles with their assigned groups in ServiceNow.
5+
It checks if every user in the target groups has all the roles assigned to that group.
6+
If any roles are missing, the script re-adds the user to the group, ensuring all inherited roles are correctly applied.
7+
8+
How It Works
9+
10+
Identify Groups
11+
The script starts by reading the list of sys_ids of the target groups.
12+
13+
Fetch Group Roles
14+
It retrieves all the roles assigned to each group from the sys_group_has_role table.
15+
16+
Check Each User
17+
For each user in the group (sys_user_grmember), it fetches their assigned roles from sys_user_has_role.
18+
19+
Detect Missing Roles
20+
Compares the user’s roles with the group’s roles.
21+
If any group role is missing for a user:
22+
23+
Removes the user from the group.
24+
25+
Re-adds the user to the group, triggering ServiceNow’s role inheritance process.
26+
27+
Logs
28+
The script logs all actions using gs.info() for easy monitoring in the system logs.

0 commit comments

Comments
 (0)