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

jshatney
Mega Expert

Setup a 7 day OLA that has a start condition of Due Date and a stop date of Work End


Setup a workflow for the OLA that sends a notification at 100% and goes only to the assigned to.


Cant we do it by setting up a schedule job , email notification & event. Cant use OLA


You could absolutely use a scheduled job, event, and email notification.



Setup a scheduled job that compares the due date and the current date.
Trigger an event if it is 7 days past due date


Send out notification.   Notification will have to come from the Task_SLA table and you will have to use task.assigned_to as your recipient.


Thats what I did...It didnt work!



1)This is the script in the scheduled job :



var gr = new GlideRecord('change_task');


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


gr.query();




var count = gr.getRowCount();


if (count > 0)


{


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


}




2) Created an event in registry named "change_task.duedate_reminder "


3) Created an email notification   when the above mentioned event is fired. Used 'aasigned_to' as the receipent!!



Tested it pressing the ''EXECUTE NOW' button in the scheduled job


PS -> I am leaving out the 7 day condition as of now!