The CreatorCon Call for Content is officially open! Get started here.

Email notification if change task 7 days past due date!

karanchawla2002
Kilo Explorer

I am trying to set up an email notification ONLY IF a change task is 7 days past due date! The email should only be sent to the person who has been assigned the change task.

Please help!

1 ACCEPTED SOLUTION

I don't think you're actually looping through the records you found in your example, so gr is referencing a set of records. Try this:



var gr = new GlideRecord('change_task');


gr.addQuery('due_date', '<=', gs.nowDateTime());


gr.addQuery('active', true); //you probably want to add this so you only send reminders on open tasks


gr.query();


while (gr.next()) {


    gs.eventQueue("change_task.duedate_reminder", gr, gs.getUserID(), gs.userName());


}


View solution in original post

11 REPLIES 11

Hmm, must be missing something small, here is what have:


License Expiry Reminder.jpg


marcusstewart
Kilo Explorer

I'm running this same script against the change request and using the end_date. My event seems to fire per the log, but the notitfication sent to use that event doesn't send.



  1. var gr = new GlideRecord('change_request');  
  2. gr.addQuery('end_date', '<=', gs.nowDateTime());  
  3. gr.addQuery('active', true); //you probably want to add this so you only send reminders on open tasks  
  4. gr.query();  
  5. while (gr.next()) {  
  6.     gs.eventQueue("change.late.closure.enddate", gr, gs.getUserID(), gs.userName());  
  7. }  

Any ideas?