Postpone "Ask for approval" due date

Tim84
Tera Contributor

Hi all,

 

we're trying to create an Approval with a due date in a Flow and then postpone the due date using a UI Action.
Unfortunately changing the due date doesn't really do anything, the approval still ends based on the original due date.

Is there a way to postpone a due date that was set in an "Ask for approval" Flow action?

1 REPLY 1

rajan_singh
Tera Contributor

To achieve postponing the due date of an approval set in an "Ask for approval" Flow action in ServiceNow, follow these steps:

1. Update the Due Date in the Approval Record
- Ensure you update the `due_date` field of the corresponding approval record in the `sysapproval_approver` table.

2. Re-Evaluate Workflow
- After updating the `due_date`, you might need to trigger a re-evaluation of the workflow to ensure that the new due date is considered. This can be achieved through a script in a UI Action or a Business Rule.

Here is an example of a UI Action script that can be used to postpone the due date:

// UI Action Script
(function executeAction(current, previous) {
// Set the new due date
current.due_date = gs.daysAgoStart(5); // Example to set a new due date 5 days from now
current.update();

// Re-evaluate the workflow
var wf = new Workflow();
wf.update(current);
})(current, previous);


3. Ensure Flow is Dynamic
- Ensure that your Flow is designed to dynamically check the approval record's `due_date` field rather than relying on a static value set at the beginning of the Flow.

If these steps don't resolve the issue, you may need to review the Flow logic to ensure that it supports dynamic updates to the due date field.