- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 04:37 AM
Hi Community,
I'm trying to build an encoded query in GlideRecord that combines multiple conditions across sys_class_name, sys_updated_by, and a relative date filter. Here's the query:
The issue is that this query does not return any results, but if I remove the GOTO part, like this:
…it works fine.
I’m not sure if the problem is with how I’m using GOTOsys_updated_onRELATIVEGT@hour@ago@24
, or if this is incompatible with GlideRecord.
Any insights or suggestions would be appreciated!
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 07:02 AM
Hi @Aditya40 ,
I have tried the same query you've shared and it's working fine
do you have data with that filter ?
you filter is this
try to copy the filter from the condition builder
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 04:46 AM
GOTO keyword won't work in GlideRecord
try this and use relative date filter
var gr = new GlideRecord('your_table');
var now = new GlideDateTime();
var last24 = new GlideDateTime();
last24.addHoursUTC(-24);
gr.addEncodedQuery('sys_class_name=incident^ORsys_class_name=problem^sys_updated_by=' + gs.getUserName() + '^sys_updated_on>=' + last24.getValue());
gr.query();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 04:46 AM
Hi,
One thing you can and should do when working with encoded queries, is to use the condition filter breadcrumb on the list view of the records you want to filter.
By rightclicking this, and copy the query you will get the result you want.
See attached image.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 07:02 AM
Hi @Aditya40 ,
I have tried the same query you've shared and it's working fine
do you have data with that filter ?
you filter is this
try to copy the filter from the condition builder
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya