/* Scheduled Script for overdue tasks */
// Get today's time and date
var rightNow = new GlideDateTime();
// Query the database for NeedIt Task records with Due date field values older
// than the current time. Only return NeedIt Task records that do not have
// a State field value of Closed Complete.
var overdueNITasks = new GlideRecord('x_58872_needit_needit_task');
overdueNITasks.addQuery('due_date','<=',rightNow);
overdueNITasks.addQuery('state','!=',3);
overdueNITasks.query();
// Write a log message for each overdue NeedIt Task Record
while(overdueNITasks.next()){
gs.info("Overdue NeedIt Task record = " + overdueNITasks.number);
}