Related List Condition Helper
Build RLQUERY filter conditions visually using the Related List Condition Helper, a Pro feature for constructing related list queries on ServiceNow lists and forms.
Last updated: April 1, 2026
The Related List Condition Helper lets you build RLQUERY filter conditions visually — no more hand-crafting encoded query strings. It discovers all reference relationships for a table, auto-detects many-to-many junction tables, and generates the correct RLQUERY syntax ready to apply or copy.
Opening the Helper
The helper is available from the Technical Names popover on both forms and lists. When Technical Names is enabled (/tn), click the cog icon on any field label pill to open the popover, then select Related List Condition Helper.
This opens the full helper modal where you can select a target table, configure conditions, and preview the generated RLQUERY:
How It Works
When you open the helper, it:
- Resolves the source table hierarchy — Walks the inheritance chain using
PAUtils().getTableAncestors()to discover all reference fields, including inherited ones - Discovers reference targets — Queries
sys_dictionaryfor all reference fields andsys_m2mfor many-to-many definitions - Auto-detects M2M relationships — If the source table is a junction table (defined in
sys_m2mor has exactly two reference fields), the M2M checkbox is pre-checked - Pre-fills context — When opened from a specific field, the helper pre-selects the appropriate target and includes the current field value in the conditions
Building a Query
Target Table
The top section lists all tables that the source table references. Each entry shows the target table name, the reference field used, and an m2m badge if the relationship is many-to-many.
Click a target to select it. If there are more than five targets, a search filter appears.
Matching Condition
Choose the count operator:
| Operator | RLQUERY Output | Meaning |
|---|---|---|
| has at least | >=1 | Target list has 1 or more matching records |
| has no | =0 | Target list has zero matching records |
| has exactly | =N | Target list has exactly N matching records |
| has at most | <=N | Target list has at most N matching records |
Many-to-Many (M2M)
Check this box when the source table is a junction table (e.g., sys_security_acl_role linking ACLs to roles). The helper auto-detects this when possible.
Conditions
Optionally add encoded query conditions on the source table. When opened from a form field, the current field value is pre-filled. When opened from a list, the active list filter is included.
RLQUERY Preview
The preview section shows the generated RLQUERY string in real-time as you adjust settings. For example:
RLQUERYsys_security_acl_role.sys_security_acl,>=1,m2m^sys_user_role=260c203a870033000e56d61e36cb0bbc^ENDRLQUERY
Actions
| Button | Action |
|---|---|
| Open Target List with Filter | Opens the target table list in a new tab with the RLQUERY applied as a filter |
| Preview Count | Runs a Stats API call to count how many records on the target table match the RLQUERY |
| Copy Query | Copies the RLQUERY string to the clipboard for use in scripts, condition builders, or URL parameters |
| Cancel | Closes the helper |
Use Cases
- ACL Debugging — Find all ACLs that reference a specific role, or all roles assigned to a specific ACL
- M2M Exploration — Navigate many-to-many relationships that are hard to query with standard list filters
- Dynamic Filtering — Build RLQUERY conditions for reports, dashboards, or scripted conditions
- Reference Validation — Quickly check how many records reference a particular record
- Scripting Optimization — Use the generated encoded query in GlideRecord scripts to filter by related list conditions in a single query, avoiding extra or nested GlideRecord lookups
Tips
- The helper works on any table — open it from list column headers or form field labels
- Use Preview Count before opening the target list to verify your query returns the expected number of records
- The conditions field supports full encoded query syntax — you can paste complex filters
- Press Escape to close the helper at any time
Related
- List Enhancements — Technical Names and other list features
- Form Enhancements — Technical Names and popover features on forms
- Related Lists (Sidekick) — Discover all related lists for a record