- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2019 04:05 PM
I have a scheduled job that runs daily, checking for records in a table that need to be processed.
The parameters are that the field "u_reminder_complete" is FALSE, and that the sys_created_on date is 30 days ago.
This scheduled job works perfectly when I comment out the eQuery line.
I've tried every dang permutation of this query that I can think of and I've scoured both the product docs and the community and nothing I have tried works.
Thanks in advance.
Here's the code:
var eQuery = "sys_created_onRELATIVEGE@dayofweek@ago@30";
var app = new GlideRecord('u_reboot_exception_expiration');
app.addQuery('u_reminder_complete','false');
//app.addQuery('sys_created_on','>','gs.daysAgo(30)');
app.addEncodedQuery(eQuery);
app.query();
while(app.next()){
//gs.eventQueue('open.costpoint.reminder', app, app.approver);
gs.log('found a record ' + app.u_computer_number);
var cart = new Cart();
var item = cart.addItem("319bedccdbdeaf00f0ad6f13ca9619f0"); //reboot removal
cart.setVariable(item, "rfw_req_name6", app.u_employee_name);
cart.setVariable(item, "rfw_req_short6", "Remove Reboot Exception for"+app.u_computer_number);
cart.setVariable(item, "rfw_req_detail6", app.u_computer_number + ' - It has been 30 days since this exception was set. IT will now remove the reboot exception from this computer.');
cart.setVariable(item, "rfw_req_assgGroup6", "0ad44fd345f7e00072f83215afc7a609"); //Security
cart.placeOrder();
app.u_reminder_complete = true;
app.update();
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2019 02:35 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2019 04:09 PM
Try
app.addEncodedQuery('u_reminder_complete=false^sys_created_onONLast 30 days@javascript:gs.beginningOfLast30Days()@javascript:gs.endOfLast30Days()')
instead of
app.addQuery('u_reminder_complete','false');
//app.addQuery('sys_created_on','>','gs.daysAgo(30)');
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2019 01:48 PM
Thanks Sanjiv. Unfortunately, this did not work. Any other thoughts?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2019 02:08 PM
Is the schedule job created on custom application scope?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2019 02:22 PM
It isn't.
I have two records in my table - created on 12/8 - and I would like the query to catch anything where the u_reminder_complete value is false and sys_created_on is 30 days or more.
The scheduled job will run every day so I could just do a query of "sys_created_on<=javascript:gs.beginningOfLast30Days()", which does work.
That will catch anything exactly 30 days old, but I was hoping to get the security of having it catch anything older than 30 days that may have fallen through the crack.