You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script analyzes role assignments in your ServiceNow instance and identifies roles that are assigned to users but appear to be unused. It cross-references user activity logs to determine whether assigned roles are actively used.
6
+
7
+
## Features
8
+
9
+
- Scans all roles assigned to users
10
+
- Checks user activity via `sys_history_line` to infer role usage
11
+
- Flags roles that are assigned but show no signs of usage
12
+
- Logs unused roles and the number of users assigned to them
13
+
14
+
## Usage
15
+
16
+
1. Navigate to **System Definition > Scheduled Jobs**.
17
+
2. Create a new Script Include or Scheduled Job named `Role_Usage_Analyzer`.
18
+
3. Paste the contents of `Role_Usage_Analyzer.js` into the script field.
19
+
4. Run the script manually or schedule it to run periodically (e.g., weekly or monthly).
20
+
21
+
## Notes
22
+
23
+
- This script uses `sys_history_line` to infer user activity. For more accurate results, consider integrating with login logs or audit tables if available.
24
+
- You can extend the script to automatically notify administrators or generate reports.
25
+
- Roles used only in background scripts or integrations may not show up in history logs — manual review is recommended.
0 commit comments