Logo

ServiceNow Encoded Query Builder

Build ServiceNow encoded queries with a visual condition editor, or paste an existing query to decode it. Generates sysparm_query URLs and GlideRecord scripts. Everything runs in your browser — no data is sent to any server.

WHERE
active=true^priority<=2^ORassigned_toISEMPTY
sysparm_query=active%3Dtrue%5Epriority%3C%3D2%5EORassigned_toISEMPTY
https://yourinstance.service-now.com/api/now/table/incident?sysparm_query=active%3Dtrue%5Epriority%3C%3D2%5EORassigned_toISEMPTY
var gr = new GlideRecord('incident');
gr.addEncodedQuery('active=true^priority<=2^ORassigned_toISEMPTY');
gr.query();
while (gr.next()) {
  // process each record
}

Joiners: ^ = AND, ^OR = OR, ^NQ = New Query (top-level OR group).

Common operators: =, !=, CONTAINS, STARTSWITH, ENDSWITH, IN, NOTIN, BETWEEN, ISEMPTY, ISNOTEMPTY, ON, BEFORE, AFTER, SAMEAS, GT_FIELD.

BETWEEN uses value1@value2 (e.g. priorityBETWEEN1@3). IN uses comma-separated values (e.g. stateIN1,2,3). Date operators accept relative values like Last 7 days or Today.

Frequently Asked Questions

What is a ServiceNow encoded query?

An encoded query is ServiceNow's compact condition syntax — field + operator + value pairs joined by ^ (AND), ^OR (OR), or ^NQ (new query group). The same string works in list filters, GlideRecord.addEncodedQuery(), and the Table API's sysparm_query parameter.

How do I use this with the Table API?

Enter your instance name and table, then copy the generated Table API URL — the query is already URL-encoded in the sysparm_query parameter. Send it as a GET request with Basic Auth or an OAuth Bearer token. Add sysparm_fields,sysparm_limit, and other parameters as needed.

What does ^NQ (New Query) do?

^NQ starts a new top-level query group that is OR'd with everything before it. It's how you express (A AND B) OR (C AND D) in flat encoded-query syntax — equivalent to clicking "New Query" in the list filter designer.

Is it safe to paste queries here?

Yes. Building and decoding run entirely in your browser — nothing is sent to a server or stored. You can verify this in your browser's network tab.

Privacy & Cookie Preferences

We use cookies to enhance your experience, analyze site performance, and support our marketing efforts. Your privacy matters, and you can withdraw consent at any time.