how to manage task escalation on due date

Titus van der M
Tera Expert

I added a related list (FINTASK) to the Financial Management app, to create tasks sent to individuals (users) related to the Fin Ticket. Every task has a mandatory (manually filled in) due date.

I would like to send an email (your task is almost overdue) to the assigned to when TASK is 1 hour before the due date (escalation = 2) and and email (Your task is overdue) when due date has passed (escalation = 3).

As being not familiar with scripting, I am looking for a solution to get the value for the Escalation field updated based on the Due Date.

Any help is welcome 🙂

Thanks!

1 ACCEPTED SOLUTION

Yes, that was the only piece that I was concerned about. Most likely you will need to restart the workflow.



I would create a business rule on your table that only triggers when the Due date field is changed:


Name: Restart WF when Due date changes


Advanced: true


When: After


Insert: false


Update: true


Conditions: current.due_date.changes()


Script:


(function executeRule(current, previous /*null when async*/) {


      new Workflow().restartWorkflow(current);


})(current, previous);



Let us know if you are successful.


View solution in original post

8 REPLIES 8

Yes! I figured it out already... Escalation got updated based on the initial Due Date (1 hour before and on due date). but..... updating the Due Date will not change the workflow (when it is already set). Is there a way to cancel the workflow and start a new one in case the Due Date changes?



Thanks!


Yes, that was the only piece that I was concerned about. Most likely you will need to restart the workflow.



I would create a business rule on your table that only triggers when the Due date field is changed:


Name: Restart WF when Due date changes


Advanced: true


When: After


Insert: false


Update: true


Conditions: current.due_date.changes()


Script:


(function executeRule(current, previous /*null when async*/) {


      new Workflow().restartWorkflow(current);


})(current, previous);



Let us know if you are successful.


Thanks for you code 🙂 I also added an extra (first) step in the workflow to set Escalation back to Normal.... unfortunately Escalation field did not change back to "Normal"...


Yes! have it fixed by using When: Before



Many thanks Christopher!