Hi, I have a situation where a process instance processes an process variable array with an multi instance loop. The array is updated by an external system as process variable through a REST API call with a JSON body. Just after this call a wait condition is triggered to process the array. From the database records it seems that the array update and the wait condition trigger are updated at the same time. The multi instance loop seems to miss the update of the array variable and finishes without processing the updated array.
Can you redesign your process so that you wait for message. Then you have your external system call the rest message api with the array as process variable?
Thank you for your suggestion. It is unfortenately not possible due to the fact that the external system is a low code platform which has limited flexibility. Only the call for modifying process variables is possible.
Ok, as a cheap hack I might try making the multi-instance thing “Asynchronous before” as then as I understand it, the executor would load everything from DB before continuing.
Thanks for your suggestion. So, when introducting save points changes to process variables are visible to the execution of the process instance? Is this somewhere described in the Camunda docs?
I’m not entirely sure that this will work, but I’d try it
You have not desribed how you update the variables so I can’t say if the transaction affects it. But you did mention that you checked from DB that the updates are simultaneous, which made me think you might be updating them directly to DB or something.
Hi JussiL, I had already aplied your suggestion and it works. Just was curiuous about documentation regading this matter. Thank you for your suggestions.
Hello @haiko !
Here are few links about the subject:
Also this: Transactions in Processes | docs.camunda.org
The reason for that is that variables are persisted only whenever the engine comes to a wait state. When your conditional event is being triggered, without introducing an async continuation (whether after the conditional event or before the multi instance) the updated variables are not reflected in the Camunda database. Therefore the subsequent task will not read them.