How to translate a ServiceNow encoded query
- Paste the query. A raw encoded query, a
sysparm_queryvalue, a list URL or a fullnav_to.dolink all work. - Read it in plain English. Each condition is shown as field, operator and value, grouped the way ServiceNow evaluates
^ORand^NQ. - Edit it visually. Change fields, operators and values without hand-editing carets.
- Copy what you need. GlideRecord code, a list URL, a Table API URL or a shareable link back to this page.
ServiceNow encoded query operators
Every condition is written as field + OPERATOR + value, with no spaces between them. These are the operators you will meet in list filters, scripts and REST calls.
| Operator | Meaning | Example |
|---|---|---|
= | is (equals) | priority=1 |
!= | is not | state!=7 |
LIKE | contains | short_descriptionLIKEvpn |
NOT LIKE | does not contain | short_descriptionNOT LIKEtest |
STARTSWITH | starts with | numberSTARTSWITHINC00 |
ENDSWITH | ends with | [email protected] |
IN | is one of (comma-separated) | stateIN1,2,3 |
NOT IN | is not one of | categoryNOT INhardware,network |
ISEMPTY | is empty | assigned_toISEMPTY |
ISNOTEMPTY | is not empty | assignment_groupISNOTEMPTY |
ANYTHING | any value, including empty | cmdb_ciANYTHING |
EMPTYSTRING | is an empty string | correlation_idEMPTYSTRING |
< <= > >= | less / greater than (numbers and dates) | reassignment_count>2 |
BETWEEN | is between two values | sys_created_onBETWEENjavascript:gs.dateGenerate('2026-01-01','00:00:00')@javascript:gs.dateGenerate('2026-01-31','23:59:59') |
ON / NOTON | is (not) on a date or period | sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday() |
RELATIVEGT / RELATIVELT | is after / before a relative time | sys_updated_onRELATIVEGT@hour@ago@24 |
MORETHAN / LESSTHAN | more / less than a time span from another date field | resolved_atMORETHANopened_at@day@after@3 |
SAMEAS / NSAMEAS | same as / different from another field | opened_bySAMEAScaller_id |
GT_FIELD / LT_FIELD | greater / less than another field | sys_updated_onGT_FIELDsys_created_on |
DYNAMIC | matches a dynamic filter, such as Me | assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe |
INSTANCEOF | is a class or any of its child classes | sys_class_nameINSTANCEOFcmdb_ci_computer |
VALCHANGES / CHANGESTO | value changes (business rule and notification conditions) | stateCHANGESTO6 |
Joining conditions: ^, ^OR, ^NQ and ORDERBY
^OR binds tighter than ^, so active=true^priority=1^ORpriority=2 reads as "active and (priority 1 or 2)". Use ^NQ when you need OR between whole groups.
| Syntax | Meaning | Example |
|---|---|---|
^ | AND: both conditions must match | active=true^priority=1 |
^OR | OR with the condition right before it | priority=1^ORpriority=2 |
^NQ | New query: OR between whole groups of conditions | priority=1^NQassigned_toISEMPTY |
ORDERBY / ORDERBYDESC | Sort ascending / descending by a field | active=true^ORDERBYDESCsys_created_on |
GROUPBY | Group results (lists and reports) | active=true^GROUPBYassignment_group |
^EQ | End-of-query marker added by some lists; safe to ignore | active=true^EQ |
^^ | A literal ^ inside a value | short_descriptionLIKEA^^B |
Common ServiceNow encoded query examples
Copy-ready queries for everyday filters. Open any of them in the translator to read or adapt it.
active=true^assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ORDERBYDESCsys_updated_on Translate Open P1 and P2 incidents, newest first active=true^priorityIN1,2^ORDERBYDESCsys_created_on Translate Unassigned work in my groups active=true^assigned_toISEMPTY^assignment_groupDYNAMICd6435e965f510100a9ad2572f2b47744 Translate Records created today sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday() Translate Updated in the last 24 hours sys_updated_onRELATIVEGT@hour@ago@24 Translate Mentions VPN in the short description or description short_descriptionLIKEvpn^ORdescriptionLIKEvpn Translate Critical, or open and unassigned (two queries) priority=1^NQactive=true^assigned_toISEMPTY Translate Operational servers of any server class sys_class_nameINSTANCEOFcmdb_ci_server^operational_status=1 Translate Using an encoded query in GlideRecord, list URLs and the REST API
The same string works everywhere. In URLs, encode it first: = becomes %3D, ^ becomes %5E and , becomes %2C.
var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^priorityIN1,2^ORDERBYDESCsys_created_on');
gr.query();
while (gr.next()) {
gs.info(gr.getValue('number') + ' ' + gr.getValue('short_description'));
}
https://<instance>.service-now.com/incident_list.do?sysparm_query=active%3Dtrue%5EpriorityIN1%2C2%5EORDERBYDESCsys_created_on
https://<instance>.service-now.com/api/now/table/incident?sysparm_query=active%3Dtrue%5EpriorityIN1%2C2%5EORDERBYDESCsys_created_on&sysparm_limit=10