what is the difference between add query and add encoded query?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 09:53 PM
o

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 10:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 10:02 PM
For More details: GlideRecord - Global

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 10:01 PM
addEncodedQuery() : you can deine multiple filter here under the one string.
addQuery(): it will basically does the same but you can only able to put one filter condition here..
Note: both used to filter out the result.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2018 10:06 PM
Hi
Adding another link will give you more understanding about addQuery() and addEncodedQuery()
- While adding filters in GlideRecord queries is good, avoid creating filters which are too complex.
Rather than creating a series of addQuery() and addOrCondition() calls to obtain a result, use addEncodedQuery(). This will make the query easier to create and maintain. Avoid complex queries on very large tables.
Create a query string by generating encoded query strings through a filter and using that string with addEncodedQuery. As an example, if I want all incidents that are active, created after a certain date with a certain state and a particular approval value I go in the instance at incidents module, expand "All" filter and add all my conditions then click "Run". Then right click on the link, "Copy query" and I get my encoded query:
"active=true^sys_created_on>javascript:gs.dateGenerate('2015-09-01','23:59:59')^state=3^approval=requested"
https://bitsofcode.io/servicenow-gliderecord-performance/