A few weeks ago, there was a post on the Camunda forum that asked how you block access to a task if the user completes a prior task. This was a business need that we encountered in other BPM systems so we decided to include it in our Apex Designer Camunda 8 Library as well.
Business Scenario
A lot of business processes require multi-level reviews. In tax preparation it is common to have a 3 step process: Prepare, Review 1 and Review 2. This is sometimes called a “four eyes” review process. Here is a simplified form of a Prepare Return process:
- Prepare: The preparer prepares the tax return and submits it for reviews.
- Review 1: A reviewer reviews the submitted return and submits it for a peer-review.
- Review 2: Another reviewer reviews the reviewed return and approves it.
Managing Task Assignments
The bottom swimlane is titled "Reviewer". To implement this in Camunda, we add a Candidate Group of "Reviewer" to the activities Review 1 and Review 2. This ensures that only users with the "Reviewer" role can perform those review activities.
The Problem
Let's say that we have 2 reviewers - Tom and Ann - responsible for reviewing a tax return. When a user prepares a tax return and submits it, a Review 1 task is created. Both reviewers can see the task in their My Tasks view:
Either Tom or Ann can claim the task and review it. Let's say Tom performs the first review, which creates a task for Review 2. This new task will show up in My Tasks view of both the reviewers:
There is nothing preventing the Tom from reviewing it again. This violates the "four eyes" review.
The Solution
We handle this scenario by adding a custom header named “excludeUsersFromActivities”. It contains a list of activity ids. Users who completed those activities can not claim the task.
In the above example, any user who performed Review 1 shouldn't be allowed to review it again. So in the header of Review 2 activity, we added the key excludeUsersFromActivities with a value of Task_Review 1.
Solution in Action
Now let's submit another task for review, which will show up in the My Tasks view of both the reviewers:
The return is first reviewed by Tom, which creates the Review 2 task. The header “excludeUsersFromActivities” will ensure that the 2nd review task is not available for Tom.
Try it Yourself
The "excludeUsersFromActivities" handling is included in version 0.1.10 of the Camunda 8 Library in Apex Designer. You can read more about how Apex Designer works with Camunda 8 and how to try it yourself in this blog post.