Creating a Dynamic Filter for HR SKills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2026 06:27 AM
Hi all,
I'm trying to give agents a filter that reads "show me cases tagged with any of the skills on my own user record" — essentially a dynamic filter 'Skills is one of my skills'. The operator does appear on the Skills field, so the option is binding. But after running the filter on a case list, the value renders null instead of One of My Skills. This happens for users with multiple skills, and in both native UI and Agent Workspace.
the setup of skills field is:
| Table | task (filtering child sn_hr_core_case) |
| Field | skills |
| Type | glide_list |
| Reference | cmn_skill |
- Labels:
-
Human Resources Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2026 11:30 AM
Hi,
The Script Include looks reasonable, so there is no need to change it initially. Since the operator appears correctly but no skills are returned, start by checking the configuration and data flow.
Go to System Definition >> Dynamic Filter Options and verify the Script/Script Include, field type, referenced table, Active, and Available for filter settings.
Test getMySkills() for the affected user and confirm that it returns the expected skill sys_ids.
Check the user's records in sys_user_has_skill and confirm that the Skill is populated and Active = true. The Script Include is specifically filtering on the current user and active records.
Verify that the skills field on sn_hr_core_case references the same table as the Skill records returned by the Script Include.
If the Script Include returns the correct sys_ids but the filter still returns no results, focus next on the Dynamic Filter Option/reference configuration rather than changing the Script Include.
This should help isolate whether the issue is with the Dynamic Filter >> Script Include >> returned values >> reference field flow.
FYR: https://www.servicenow.com/docs/r/platform-user-interface/t_DynamicFilterOptions.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2026 05:50 AM
Hi, thanks for the troubleshooting steps. I’ve verified those parts:
- getMySkills() returns the expected sys_ids for the affected user.
- The user has active records in sys_user_has_skill, and each has a populated Skill.
- sn_hr_core_case.skills is a glide_list referencing cmn_skill, which is also the table referenced by the returned skill sys_ids.
- The Dynamic Filter Option is active, available for filtering, has no role restriction, and uses the glide_list field type.
A direct query against HR cases using those skill sys_ids returns matching cases.
The issue is that the is (dynamic) operator appears, but after I select the option, its value displays as null. So far, I haven’t confirmed whether that is only a display issue or whether the dynamic option is failing to resolve when the filter runs.
Has anyone seen this behavior with a Dynamic Filter Option on a glide_list field? Is there a specific return format or script-field syntax required for this field type? What’s the best way to verify whether the selected option is actually being evaluated?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2026 06:52 AM
Hi Gillian,
Since `getMySkills()` is returning the expected `sys_id` values and the same IDs return matching cases with a direct query, the Script Include itself looks fine.
The next step is to isolate the **Dynamic Filter Option + `glide_list`** behavior.
Try these checks:
1. Temporarily return a single known `cmn_skill` sys_id:
return ['<known_skill_sys_id>'];2. If the Dynamic Filter still displays `null`, the issue is likely not the `GlideRecord` query.
3. Test the same Dynamic Filter Option against a normal **Reference** field to `cmn_skill`. If it works there but not with `sn_hr_core_case.skills`, that points toward a limitation/issue with the `glide_list` field.
4. Also confirm that the Dynamic Filter Option is configured with `cmn_skill` as the reference table and that the returned values are valid sys_ids.
The current approach of building an array with:
skills.push(gr.getValue('skill'));is appropriate. There is no need to convert it to an encoded query such as `sys_idIN...` unless the Dynamic Filter specifically requires that format.
The single-sys_id test should help determine whether the problem is with the **Script Include return value** or with how the Dynamic Filter evaluates a **glide_list** field.
Helpful? Please mark the response as Accepted Solution ✅ and close the thread — this helps future readers find the solution faster.
Regards,
Sachinvic
✨ ArchX Certified | ✨ 16x ServiceNow AI MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The script include logic looks sound, since it returns an array of skill sys_ids with a safe fallback. A null label in the filter breadcrumb usually points to the dynamic filter option not running or not finding the script, not to the query itself.
These are the first things to check:
- Open System Definition > Dynamic Filter Options and open your record.
- Set the Script field to call the script include with its scope, for example javascript:new global.MySkillsFilter().getMySkills(). If your script include is in a scoped app, use that scope name instead of global.
- Make sure the script include is Accessible from All application scopes.
- Mark the script include as Client callable, since a community reply on a similar dynamic filter suggests this.
- Turn on Sandbox for the dynamic filter record, as the same reply advises.
- Check that Field type and Reference table on the option match your field, which is probably List (glide_list) with cmn_skill. I’m not sure of the exact field labels in your release.
- Run new global.MySkillsFilter().getMySkills() as a background script, logged in as an agent through impersonation or from that agent’s own session. Check that it prints real sys_ids and not just -1.
Then check the field names on the User Skill table in the script. I’m not certain active exists on sys_user_has_skill, so confirm it on the table’s dictionary. If it doesn’t exist, the query may return no rows and your script will fall back to -1.
A user with multiple skills may behave differently in the preview. Test with one skill first, then with several, to see whether the issue depends on the count.
Since the breadcrumb is rendered by the filter UI, the label shown can also be cached. Clear the cache and reload the list after changing the option.
Test in sub-production first and use an update set.
Sources: