Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2018 06:23 AM
What I want is query by using from to.
For example,
var rec = new GlideRecord('incident');
rec.addQuery('sys_created_on','<',todate);
rec.addQuery('sys_created_on','>',fromdate);
in server script.
But it doesn't work well.
(fromdate and todate is GlideDateTime Object.)
Does anyone know how?
Solved! Go to Solution.
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2018 06:43 AM
Hi tmiya,
The following script can be helpful:
var fromdate = new GlideDateTime('some start date');
var todate = new GlideDateTime('some end date');
var gr = new GlideRecord('incident');
gr.addQuery('sys_created_on', '>=', fromdate);
gr.addQuery('sys_created_on', '<=', todate);
gr.query();
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2018 05:38 AM
Glad you got it to work...
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!