
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on ‎11-04-2020 02:54 AM
Hi
Did you ever wanted to allow your Approval end-users to exit the "Approval - User" Workflow Activity with another option except "Approved" or "Rejected"?
Maybe you wanted your Approval users to offer the option like
- "No longer Required", which e.g. would "CANCEL" the Approval for any reason, but NOT to be rejected to approved. Maybe you want to distinguish the outcome by having this option
- "More Information Required", which may be needed, if the Approver does not have enough information to decide on the Approval.
The OOB "Approval - User" Workflow Activity just offers the "Approved" and "Rejected" Exit Condition, which are not sufficient in such a case.
What you will learn in this article
In this article, I will show you, how to add two new Exit Conditions to your "Approval - User" Workflow Activity in your workflows and what to do, to make them work as expected.
Steps to go:
- Add the desired Exit Conditions to your "Approval - User" Workflow Activity in your workflow
- Add a Script to the Properties of the "Approval - User" Workflow Activity to react to the new conditions
- Copy an existing OOB Business Rule to fire on the new state values of the Approval record
- Do a test-drive and enjoy the outcome 🙂
!!! ALWAYS TRY OUT FIRST IN NON PRODUCTION INSTANCE !!!
1. Add the new "Exit Condition" to your Workflow in the "Approval - User" Activity
In my example, I add TWO new exit conditions ("No longer Required" and "More Information Required").
Go to the workflow where you want to add the new condition and open that workflow in Edit-Mode.
In Workflow Editor, right-click in the white area below the green header of the "Approval - User" Workflow Activity (like shown in the screenshot below), and select "Add Condition"
Configure the first additional Condition as shown in the below screenshot:
Configure the second additional Condition as shown in the screenshot below:
2. Add a Script to the Properties of the "Approval - User" Workflow Activity
Open the Workflow Activity Properties for the "Approval - User" Activity and change the Condition for approval to Script (see details in the screenshot below).
Add the script as I did in the screenshot to react to the new states:
3. Cope the OOB Business Rule "SNC - Run parent workflows (Approval)
Navigate to the Business Rules list in the backend and search for the Business Rule shown in the screenshot below.
NOTE:
To select the one Business Rule with the "Order = 100" (because there are TWO BR with the same name!)
Change the NAME of the BR (similar to that what I did in the screenshot below).
Right-click the header and click "INSERT AND STAY" (do NOT select SAVE to overwrite the OOB BR !!!)
Change the "Condition" as shown in the screenshot above and SAVE.
NOTE:
That new Condition makes the NEW Business Rule trigger when the Approval was changed to "not_required" OR "more_info_required". The Business rule "nudges" the Workflow to advance when the state of the Approval Record changes. Without this Business Rule, the Workflow would not be "informed" about any decision done for the "not_required" and "more_info_required" states.
4. Test-Drive and Enjoy
Now, test the changes.
Create a new record, that fires your workflow. My Test-Workflow looks like shown in the screenshot below:
Setting the Approval to (e.g.) "More Information Required" now nudges the Workflow to advance:
The workflow now advances to the given path.
WRAP UP
You do not change any OOB functionality as you COPY the existing BR and change it accordingly.
You need to do that for every single "Approval - User" Workflow Activity, that you place in your workflow, but you can adjust according to your business needs.
Let me know if you have any doubts, questions, or comments on this article.
Any additional information is welcome.
Thank you for reading, and I hope you enjoyed this article.
Please provide your feedback on this article in the comments below.
If you like it, just mark this article as helpful and bookmark it using the "Bookmark" button above for later access.
Have fun and built something on ServiceNow!
Dirk
---------------------------------------------------------------------
If you like to also review my other articles on the ServiceNow Community, please have a look at the overview here:
NOTE: The content I provide here is based on my own experiences and does not necessarily represent my employer's views.
- 2,827 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Great Article..! Thank you for sharing.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Dirk,
really nice article.
I have one doubt ...I have created same as you mentioned above it's working fine instance(ROME).
but in instance (Quebec) its not working is there any issue with instance version.
Thanks.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I can't get it to work with San Diego, either. I thought maybe the 'More Information Required' button was returning a different string than 'more_info_required', and that was breaking it, but... No. It is returning a different string ('more Info required'), but changing the strings to that (and content.more_info_required to content['more Info required'] in the first script) did nothing. I'm sure there's something else I'm missing.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Somewhat following up on my own comment, but I did a bit of testing, and was able to get it to work (as implied in that comment, this is in the San Diego release).
Getting into that script in step (2), the counts object does not even have a field for more_info_required, let alone a value for it. My kludge is to look for a counts object with 'requested' > 0, and approved and rejected both being 0.
I think what's going on is that more_info_required was removed from the counts object (I don't know of any way to look at the Rome code to verify that). At the very least, WorkflowApprovalUtils has a _getApprovalCounts() function that returns an object that corresponds with what I'm seeing in the script.
Some warning; you will likely want the 'More Info' option to feed into a loop somehow. I'm experimenting with having it feed into a 'Wait for condition'. If you try to go too directly back into the same approval, you'll get some very weird results involving transactions seeming to hang but maybe working (which... seems like it might feed a resource leak, though I don't know for sure).
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Screenshots are not available , can you please repost it.
Thanks in advance
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Any chance you could share the screenshots at all? They are all blank now sadly.
Thank you, Mike
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi Dirk,
Great article which will potentially help me to configure "More Information Required". However, any chance you can get the screenshots to appear in this article?
Cheers,
~Paul