Skip to content

Commit f543998

Browse files
Create README.md
1 parent d09071b commit f543998

File tree

1 file changed

+26
-0
lines changed
  • Server-Side Components/Scheduled Jobs/Role Usage Analyzer

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Role Usage Analyzer for ServiceNow
2+
3+
## Overview
4+
5+
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.
26+

0 commit comments

Comments
 (0)