Workflow Skipped Approvals result in… Approved?!
Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
| Workflow Editor is a legacy product to maintain existing workflows already in production. For new use cases and workflows, use ServiceNow Workflow Studio. Workflow Studio is a low-code alternative to Workflow Editor. |
|---|
Hi there,
Ever stumbled over Approvals within Workflows, which got Skipped though resulted in Approved? Somehow out-of-the-box the behavior of Workflow Utilities "Approval - User" and "Approval - Group", is set up in such a way that the Skipped state on Approval records result in following the Approved transition. Maybe you are okay with this, that's fine. Personally, I would question this behavior. For example, if you've set up the Approval incorrect, the Approval record will get skipped and result in being Approved. So if you are requesting a new mobile phone/laptop/car, and the Approval got Skipped… that can't be correct?
How can we change this behavior when working with Workflows? Or even better, how can we change this behavior by default?
Out-of-the-box
To visualize what we are talking about when discussing Skipped Approval records which result in the Approved transition:
There are several reasons an Approval record could result in the Skipped state. That's a different topic ![]()
Conditions
So why are Skipped Approval records resulting in the Approved transition? When looking more closely to the Conditions on - in our example - the "Approval - User" Activity, you'll notice Skipped is actually set up in the Approved Condition.
Approved Condition
activity.result == 'approved' || activity.result == 'skipped'
Rejected Condition
activity.result == 'rejected'
To change this behavior, you could easily move the "|| activity.result == 'skipped'" part to the Rejected Condition. Just Publish the Workflow, and for all new Workflow Context your change would already be applied!
Permanent adjustment
In the step above, we changed the Conditions on a specific "Approval - User" Activity within one Workflow. Though, could we change this for all future use of the "Approval - User" and "Approval - Group" Activities?
The Conditions which are applied upon drag & drop of a new "Approval - User" Activity onto your Workflow Canvas, are actually stored within the "Condition defaults" table [wf_condition_default].
These Conditions can be changed! You could just change the Condition field like in the step above. The difference being, changing the wf_condition_default record would be applied on all future "Approval - User" Activities being added to a Workflow!
Note: The change of the wf_condition_default record(s) will not have an effect on existing Workflows.
Result
When re-running our Workflow, the "Approval - User" Activity should result in Skipped again. Though, with this adjustment, instead of the Approved transition, the Rejected transition should be followed.
Share
An Update Set with these Condition adjustments can be downloaded from Share:
- Improved Approval Utility Conditions
---
And that's it actually. Hope you like it. If any questions or remarks, let me know!
Kind regards,
Mark Roethof
ServiceNow Technical Consultant @ Quint Technology
1x ServiceNow Developer MVP
1x ServiceNow Community MVP
---
https://www.servicenow.com/community/developer-articles/workflow-skipped-approvals-result-in-approved/ta-p/2302984
