- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 12:05 AM
Hi Team,
I am trying to get the data from the table, based on two conditions, the below snippet I am trying to pull the records from the table which has "type=x & type=y".
Can anyone please guide me.
<g:evaluate var="jvar_gr" object="true">
var gr = new GlideRecord("table_name");
var gr2=gr.addQuery('type','x');
gr2.addorCondition('type','y');
gr2.addEncodedQuery('beginONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)')
gr2.query();
gr2;
</g:evaluate>
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 05:19 AM
It is addOrCondition, not addorCondition.
You can also string it: gr.addQuery('type','x').addOrCondition('type','y'); and forget the second variable declaration.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 12:20 AM
Hi Smitha,
Please adjust the script like the one shown below:
var gr = new GlideRecord("table_name");
var queryString = " beginONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)";//Give the query string which you got from the list
var gr2=gr.addQuery('type','x');
gr2.addorCondition('type','y');
gr.addEncodedQuery(queryString);
gr.query();
while (gr.next()) {
//the operation you want to do for the records satisfying above condition
}
Hope this will help you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 01:25 AM
Hi Ajai,
I don't have any issues with addEncodedQuery , I am facing problem in pulling records of "type". Is my code correct in quering ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 02:56 AM
Hi smitha,
I have rearranged it a bit. Not only the encoded query. It is gr instead of gr2. Please check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 03:40 AM
var gr2=gr.addQuery('type','x');
gr2.addorCondition('type','y');
Here , I am getting the data only for the first query , it is not executing the second query.