Dynamic number of user approval task driven by conditions in table data

Dear Team,

I hope everyone is good and doing well.

I have a requirement where i am designing a health insurance claim approval process.

Here after submission of the claim the number of approval user task varies depending upon amount of money claimed.

For example -
if 0 < claim amount < 10000 then first level finance user approval
If 10000<= claim amount < 100000 then first and second level finance user approval

and so on till seventh level approval.

Adding to it the nature of user approval task of different level are different.

Moreover, these rules of claim amount are not static, these would be maintained in a database table and managed by system admin.

So the threshold amounts can be changed like
0< claim amount < 20000 - first level approval only

So the table data will drive the number of user task to complete the process instance.

Hope i am able to clear the problem statement.

Is there any way i can achieve it in Camunda?

Thanks to experts in advance for reading the post.

Best regards,
Sourab

1 Like

To achieve a dynamic approval workflow in Camunda based on the claim amount with approval levels stored in a database, you can follow this approach:

Solution Overview

  1. Design a Database-Driven Decision Table: Store the thresholds and required approval levels in a database table that an admin can update. Each record should contain:
  • min_amount and max_amount columns to represent the claim amount range.
  • approval_levels column, indicating the number and type of approval levels needed.
  1. Retrieve Rules in a Script Task: Use a script or service task in the process model to query the database for the approval rules based on the claim amount. The task would fetch the necessary approval levels dynamically.
  2. Implement a Multi-Instance User Task for Approvals:
  • After retrieving the approval levels, use a multi-instance user task, which will repeat based on the number of approval levels required.
  • Set the approval_level variable dynamically, defining who needs to approve at each level.

this link can also help you with the implemetation of multi-Instance User Task after getting the cardinality with a script or a java delegate from databse : Multiple-Instance

Dear Oussama Tayari,

First of all thanks for responding on the post and guide me to the solution. I am actually a newbie in Camunda platform.

I have one confusion about the MultiInstance User task.
In the use case the the dynamic number of User task can be of different nature. For example -

  1. If Claim Amount is between 100 to 10000 then one level of HR approval who can take three action
    a. Forward to Finance approval
    b. Sendback to Claim applicant
    c. Reject the approval
  2. If Claim amount is between 10001 to 100000 then two levels of HR approval.

First level of HR approval -
a. Forward to second level HR approval
b. Sendback to Claim applicant
c. Reject the approval

Second level of HR approval -
a. Forward to Finance approval
b. Sendback to First Level HR approval
c. Reject the approval

This will continue upto N level as per the Claim amount. Last level will be the Finance approval.

I believe I am able to explain the use case of dynamic nature of HR approval as per Claim amount.

Could you please advise how can i achieve this using MultiInstance User task?

Thank you for your patience and reading the post.

Best regards,
Sourab