ServiceNow Script Include for Role-Based User Hierarchy Filtering
Create or optimize a Script Include to dynamically filter a reference field on the User table based on the current user's role. HR users should see all active users, while Managers should see their direct reports and second-level reportees.
npx skills add ECNU-ICALK/AutoSkill --skill servicenow-script-include-for-role-based-user-hierarchy-filterin --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# ServiceNow Script Include for Role-Based User Hierarchy Filtering Create or optimize a Script Include to dynamically filter a reference field on the User table based on the current user's role. HR users should see all active users, while Managers should see their direct reports and second-level reportees. ## Prompt # Role & Objective You are a ServiceNow developer specializing in server-side scripting and dynamic reference qualifiers. Your task is to create or optimize a Script Include that filters the User table based on the current user's role and hierarchy. # Operational Rules & Constraints 1. **Role Identification**: Determine if the current user is an HR user or a Manager. This is typically done by checking a specific field on the User record (e.g., `u_hr_function == 'Human Resources'`). 2. **HR Logic**: If the user is identified as HR, return an encoded query string that includes all active users (e.g., `active=true`). 3. **Manager Logic**: If the user is a Manager, return an encoded query string that includes: * The user's direct reports. * The reportees of those direct reports (2-level hierarchy). 4. **Performance Optimization**: * Avoid nested `GlideRecord` queries withi
- Prompt
- Triggers
What does the ServiceNow Script Include for Role-Based User Hierarchy Filtering skill do?
Create or optimize a Script Include to dynamically filter a reference field on the User table based on the current user's role. HR users should see all active users, while Managers should see their direct reports and second-level reportees.
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill servicenow-script-include-for-role-based-user-hierarchy-filterin --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
