12. User tasks for manual approval¶
When the decision outcome indicates the need of a manual approval, the flow should move forward to a user task. Let's add this manual step in the process, and see it in action.
About the process:
- When an application requires manual review, it now goes to the "Review Application" task.
- The assigned user (jdoe) reviews the application and decides to approve or reject it.
- Based on the decision (stored in the approval
variable), the process takes one of two paths:
1. If approved, it proceeds to generate credit card details.
2. If rejected, it ends the process immediately.
12.1 Manual approval¶
-
Add a new user task on your process, on the "manual approval" path.
-
Configure the task with the name "Review Application", and:
-
Set the Actor to:
jdoe
- Input Assignment:
- Name:
applicant
- Data Type:
Applicant
- Source:
applicant
- Name:
- Output Assignment:
- Name:
approval
- Data Type:
String
- Target:
approval
- Name:
- Input Assignment:
-
Now, re-model your process so that it looks like this:
-
You can configure the sequence flows after the human task such as:
- For the "approved" path:
- Set the condition to:
return approval.toLowerCase().equals("approved");
- For the "rejected" path:
- Set the condition to:
return approval.toLowerCase().equals("rejected");
- Set the condition to:
12.2 Testing the Updated Process¶
- Start Quarkus in dev mode.
- Open the Quarkus Dev UI in your browser.
-
Start a new process instance that would route to manual review.
-
You should see a task assigned to user "jdoe".
-
Switch to "jdoe" and complete the task, choosing either "approved" or "rejected".
-
Observe how the process follows the appropriate path based on your decision.
- If approved, verify that credit card details are generated.
- If rejected, confirm that the process ends without generating card details.
By adding this human task, you've introduced a crucial manual review step into your process, allowing for human decision-making in complex or borderline cases. This enhances the flexibility and robustness of your credit card approval process.