Help with Auto-approval in Workflow

Keri1
Kilo Expert

On a catalog item we have a single user approval before the catalog tasks begin. To save some time and effort we're implementing a consent through silence approach after 3 business days, where if the approver takes no action the item is auto-approved. We've successfully setup the auto-approval with a timer, if statement, and Set Value, but I'm having trouble with what happens if the approver manually takes action on the request. To make sure the Approval - User task accepts the auto-approval update we have the wait for set to this condition based script:

if(current.approval == 'approved'){
    answer = 'approved';
}

Unfortunately this seems to render any manual user approve or rejects useless. Is there scripting we can add to the above or do we need to have two separate Approval - User tasks, the second using the standard "anyone approves" option? Or perhaps is there something we can do to cancel the timer if a manual approve/reject is done?

1 ACCEPTED SOLUTION

Keri1
Kilo Expert

For those interested, here's what our solution turned out to be:

find_real_file.png

 

Both the manual approval task and the timer begin at the same time. If the manual approval is approved/rejected, the request moves forward and the timer eventually runs out. The key was to add an approval action after the timer: if the manual approval had not been completed the workflow would disregard the pending approval, thus marking it as completed. The manual task would then change to "No longer required" and the workflow progressed.

View solution in original post

11 REPLIES 11

Hi Keri,

The wait for condition will be separate activity based on script and no relation with Approval - User task activity.

Branch will go to 2 activities: 1 will be timer based on days and another will be wait for condition based on script

for both the activities their output transition should go to further activity of creating catalog task

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

The problem is this doesn't address the Approval - User task. If the approval task is left to approve when anyone approves and the timer completes and approves the request, the Approval task is left open. This causes problems later in the workflow (we have a Join later on) because there is still an open task. This is why we have the condition based script on the approval task.

The problem with the condition based task is that it seems to render the manual approve/reject actions taken on the task useless. The approver can go in and select approved and the approval task state is updated but the workflow does not progress. The approval task, though approved, stays in a Running state until the Timer completes.

The Wait for Condition doesn't seem to help either of these issues.

vinothkumar
Tera Guru

You can create a scheduled job and query the  sysapproval_approver and add the necessary condition to query the record that was not updated more than three days, instead of using the workflow.

Keri1
Kilo Expert

For those interested, here's what our solution turned out to be:

find_real_file.png

 

Both the manual approval task and the timer begin at the same time. If the manual approval is approved/rejected, the request moves forward and the timer eventually runs out. The key was to add an approval action after the timer: if the manual approval had not been completed the workflow would disregard the pending approval, thus marking it as completed. The manual task would then change to "No longer required" and the workflow progressed.

May I know what have you passed in the 'if' condition here?

 

Thanks in advance,

Juilee