Why Incident Query Results Differ Between UI and Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Problem
I ran into a situation where an incident query returned different results when run from a script (GlideRecord) versus what I saw in the UI list view. At first, it looked like a data or ACL issue, but everything checked out.
Solution
The difference came down to implicit filters and context applied by the platform.
What I learned:
The UI automatically applies contextual filters such as relationship logic, view-specific conditions, or extensions
A GlideRecord query only returns what you explicitly define
In some cases, extension points or UI-specific logic can further influence what the user sees
Once I compared the actual encoded query used by the UI with the script query and accounted for those additional conditions, the results aligned.
Why this matters
If you’re:
Debugging “missing” records
Comparing UI behavior vs backend logic
Writing scripts that must match list results exactly
This distinction is critical and easy to overlook.
Takeaway
To avoid confusion:
Always capture the exact encoded query from the UI
Don’t assume the UI and scripts run with the same context
Check for extension points or UI logic before assuming ACL issues
Sharing this in case it saves someone else time.
*Please mark a thumbs up Helpful if you find a good post.