- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2016 12:33 PM
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!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2016 02:13 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2016 02:04 PM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2016 02:13 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2016 02:49 PM
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"...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2016 03:19 PM
Yes! have it fixed by using When: Before
Many thanks Christopher!