Update process variables for multiple instances

We can update process variable for a single instance using process-instance/aProcessInstanceId/variables rest api. I wanted to know if we can update process variable for multiple instances at once, either by providing multiple instance id’s or by correlating the instances using another process variable.

If you try to update the same variable using the Multi-Instance, and your Multi-Instance is set to Parallel, you are going to hit Locks because of multiple jobs trying to edit the same data at the same time. If you set to sequential you should be fine. See: Pattern Review: DMN Looping for Array Input

In this case, engine will throw OptimisticLockingException??

yes it will throw that error. Its all detailed in the link above and the related links on that page

Hi @StephenOTT, perhaps I did not frame the question correctly. What I wanted to know is, if we can update a process variable value outside of the process definition.

For eg. A process has process variable declared DateOfSubmission. Now an instance of this process was created with DateOfSubmission value - 26-08-2019. Later on it is realized the DateOfSubmission was incorrect, actual value should have been 20-08-2019.

Now we try to update this value using an out of box camunda rest-api, process-instance/aProcessInstanceId/variables api using a rest client(postman).

Now this aProcessInstanceId accepts only single instanceId, so if I have to update DateOFSubmission process variable for 100 instances I have to run this rest api by providing value of aProcessInstanceId 100 times in rest client.

Is there a efficient way to handle such situation?

1 Like

Even I am having same question please if anyone knows the solution it will be helpful for us

Hi Satish,
Is it the same value that needs to be updated in all process instances or its different values?