- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 12:52 PM
Hello i am trying to run a background script and one of the condition is for 'sys_created_on" to be after a certain date while the other conditions are or conditions based on catalog names. However, when running this background script i see that the results are not within the parameters of the date condition. Would anyone know why the date condition of the script is not being executed correctly? Please note this is just the top portion of my script and not in its entirety but i believe the problem exist here.
var gr = new GlideRecord('sc_req_item');
gr.addOrCondition('cat_item', "Pens, Pencils & Markers");
gr.addOrCondition('cat_item', "Printer Supplies");
gr.addOrCondition('cat_item', "Paper");
gr.addOrCondition('cat_item', "Miscellaneous");
gr.addOrCondition('cat_item', "Mailing & Envelopes");
gr.addOrCondition('cat_item', "Desk Accessories");
gr.addOrCondition('cat_item', "Calendars & Planners");
gr.addOrCondition('cat_item', "Basic Supplies");
gr.addOrCondition('cat_item', "Adhesives & Tape");
gr.addOrCondition('cat_item', "Binders & Folders");
gr.addOrCondition('cat_item', "Binders & Folders");
gr.addQuery('sys_created_on' > '2018-04-20 16:09:35');
gr.query();
while (gr.next()){
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 01:03 PM
You have not formatted your date query correctly. Try this instead:
gr.addQuery('sys_created_on', '>', '2018-04-20 16:09:35');
See the documentation on addQuery() here for more info:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 01:03 PM
You have not formatted your date query correctly. Try this instead:
gr.addQuery('sys_created_on', '>', '2018-04-20 16:09:35');
See the documentation on addQuery() here for more info:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 02:09 PM
Thank you!