- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 07:54 AM
Hello All
I am running script include function and just notice that
this code lines sequence does not filter for active records
var gr = new GlideRecord(someTable);
gr.addActiveQuery();
gr.addEncodedQuery(strQuery); //
gr.query();
but this one does
var gr = new GlideRecord(someTable);
gr.addEncodedQuery(strQuery);
gr.addActiveQuery();
gr.query();
I could not find any docs regarding this
Does anyone have the same experience? Where could I read about it?
thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 08:43 AM
Does the encoded query contain an or condition? Or (multiple) layered and conditions?
Then it would matter if the active=true is at the beginning. Or at the end and then part of an or condition for example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 10:24 AM
Hello Willem
Yes, you right about multiple conditions. I found the cause and fixed it.
thank you for your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 11:41 AM
Hi,
Technically if you are using encodedQuery. you need to include active=true within the same encoded query so that the results are filtered accordingly.
Adding encodedquery after addactivequery overrides the encodedquery.
Adding activeQuery at the last gives you results because it applies active=true on the result of the encodedQuery filter.
Mark the comment as a correct answer and helpful if this answers your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 12:44 PM
I don't think that's true as my images show the query construct as able to produce the same result. Unless you're referring to when the encoded query has an OR condition? If so, then yes, if the encoded query has an OR, any additional .addQuery / .addActive will only apply to the secondary query

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 12:59 PM
Yes, thats correct and thats that I thought i had typed, but now when i recheck, i noticed that i missed it 🙂
Thanks for pointing it out.