Untitled

 avatar
unknown
plain_text
13 days ago
695 B
2
Indexable
(function executeScheduledScript(current) {
    var gr = new GlideRecord('needit_task'); // Ensure the table name is correct
    var now = new GlideDateTime();
    var futureDate = new GlideDateTime();
    futureDate.addDays(1); // Adds 24 hours to current time

    gr.addQuery('due_date', '>=', now); // Current date and time
    gr.addQuery('due_date', '<=', futureDate); // Up to 24 hours from now
    gr.addQuery('state', '!=', 'Closed Complete'); // Exclude closed tasks

    gr.query();

    while (gr.next()) {
        // Perform actions with the queried records (e.g., notifications)
        gs.info("NeedIt Task due soon: " + gr.number); // Log or handle as required
    }
})(current);
Leave a Comment