- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
What’s the difference between GlideRecord’s addQuery() vs. encoded queries – when to use which?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Its just different ways of querying the table.
gr.addQuery(‘active’ , true);
gr.addEncodedQuery(“active=true”);
Both will return the same results.
Some points to note:
1. Encoded queries are short and allow you to combine multiple queries in single line , like “active=true&state=4”. If you write this using addQuery, you will have to write 2 addQuery statements, one for active and another for state.
2. Encoded query allow you to simply copy query from filter condition in table and add to script, this helps to avoid writing complex date related logic like created 2 weeks ago.
The data returned is same in add and encoded queries.
Please mark the answer correct/helpful accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
addQuery() → build query step by step, useful for dynamic queries.
Encoded query → single string, good for static/complex filters.
addQuery() → Used to add conditions step by step in your script.
Example: gr.addQuery('priority', '1');
Encoded Query → A single string that contains all conditions together.
Example: gr.addEncodedQuery('priority=1^active=true');
Use addQuery() when building conditions dynamically in code.
Use encoded queries when you already know the full query string.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Its just different ways of querying the table.
gr.addQuery(‘active’ , true);
gr.addEncodedQuery(“active=true”);
Both will return the same results.
Some points to note:
1. Encoded queries are short and allow you to combine multiple queries in single line , like “active=true&state=4”. If you write this using addQuery, you will have to write 2 addQuery statements, one for active and another for state.
2. Encoded query allow you to simply copy query from filter condition in table and add to script, this helps to avoid writing complex date related logic like created 2 weeks ago.
The data returned is same in add and encoded queries.
Please mark the answer correct/helpful accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
addQuery() → build query step by step, useful for dynamic queries.
Encoded query → single string, good for static/complex filters.
addQuery() → Used to add conditions step by step in your script.
Example: gr.addQuery('priority', '1');
Encoded Query → A single string that contains all conditions together.
Example: gr.addEncodedQuery('priority=1^active=true');
Use addQuery() when building conditions dynamically in code.
Use encoded queries when you already know the full query string.