Passing Variable into sequential Multi-instance Loop

Hi, I am having a process with one user task and user task is configured with sequential Multi-instance .
I have a requirement of passing a variable updated in 1st loop to user task to the 2nd loop.

lets say that, There is a field called “First Name” in user task. so when we fill the value of First Name field lets say “First Name = John” then In 2nd loop of multi-instance of user task we should be able to get the value populated in field “First Name” as john.

could anyone please help me on this.

Hi,
For user tasks, this should work out of the box. No additional configuration is required.
Let’s say you run a sequential multi-instance user task with three instances:

  1. Instance sets firstname = “John”
  2. Instance sets lastname = “Smith”
  3. Instance sets country = “UK”

Every instance of the task can access the variables that have been set by the predecessors.
In the example:
2. Instance can see firstname is “John”
3. Instance can see firstname is “John” and lastname is “Smith”

I hope this helps you with your process.

Hi Stephan,

Thanks for your help, what you explained that is exactly my requirement, can you explain me how it can be achieved because I tried without any configuration but it didn’t work

So, I used the following model in Camunda 7.17 (Run):
test_process.bpmn (2.8 KB)
It runs the user task three times (hard-coded). I did not configure any forms. Using Camunda’s generic form feature, I added the mentioned variables (firstname, lastname, address) and their values manually.
In each instance of the activity, I was able to load the variables that I’ve set in the previous instances.

2 Likes

Thankyou Stephan for Quick Response. as you suggested its working but requirement is how we can update the value of the Variable and make this updated value available in next instance .

Let us say -
1st instance sets firstname = “John”
2nd Instance sets firstname = “Bolt”
then in the 3rd Instance I can see firstname = “Bolt”

That works just the same:

  1. instance sets the variable
  2. instance updates the variable
  3. instance can see the updated value

I tried it with the example I provided above; it worked right away.

1 Like