Encoded query strings
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2014 10:31 PM
How do I put brackets in encoded query strings (for ui reference fields, in this case)?
I want to distinguish "(A and B) or C" from "A and (B or C)" so I put brackets in but they seem to be ignored.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2014 10:55 PM
Clinton.
First thing is ,to form a Encoded query you can apply the filter what ever you need in list layout and once you applied your filter get the query by clicking on copy query as below
Also I don't think so that you need to put bracket.
If you see in the above screen shot I have applied query like (Active=true&&Priority=High)ORcategory=inquiry/help
then when you click on 'copy query' query looks like
active=true^priority=2^NQcategory=inquiry
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2014 10:57 PM
Hi, simply use below:
gr.addQuery('incident_state=1^active=true^NQincident_state=4');
I was trying to get all ("New" and "Active") incidents OR all ("Closed") incidents.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2014 01:54 AM
if you learn difference between 'OR' condition beside 'Save' button and the normal 'OR' condition beside query , your problem is solved...
The 'OR' condition on top (beside 'Save') is a whole 'OR' condition for the all the query's added.. the 'OR' condition beside the query , will add 'OR' query for the current query..
Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 01:31 PM
But using the top-level OR will effectively put an ^NQ in your query and you'll run into the problem described in KB0564887 - Using operator (^NQ) in encoded queries causes incorrect reference links in the list vie....