Skip to content

Commit bdfbf4d

Browse files
Create README.md
1 parent d09071b commit bdfbf4d

File tree

1 file changed

+24
-0
lines changed
  • Server-Side Components/Script Includes/Role Usage Analyzer

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Role Usage Analyzer (Audit-Based) for ServiceNow
2+
3+
## Overview
4+
5+
This script analyzes role assignments and identifies roles that may be unused by checking user activity in the `sys_audit` table. It focuses on recent activity (last 90 days) to determine whether users assigned to a role have interacted with the system.
6+
7+
## Features
8+
- Uses `sys_audit` for accurate activity tracking
9+
- Filters audit records from the **last 90 days** to reduce data volume
10+
- Flags roles assigned to users who show **no audit activity**
11+
- Logs potentially unused roles with user count
12+
13+
## Usage
14+
15+
1. Navigate to **System Definition > Script Includes** or **Scheduled Script Executions**.
16+
2. Create a new Script Include or Scheduled Job named `Role_Usage_Analyzer_Audit`.
17+
3. Paste the contents of `Role_Usage_Analyzer_Audit.js` into the script field.
18+
4. Run manually or schedule it to run periodically (e.g., monthly).
19+
20+
## Notes
21+
22+
- The script uses `gs.daysAgo(90)` to limit the audit data to recent activity.
23+
- You can adjust the time window by changing the `gs.daysAgo()` value.
24+
- Consider extending the script to generate reports or notify role owners for cleanup.

0 commit comments

Comments
 (0)