hi, I’m trying to delete a task of multi-instance task with process instance modificatoin.cancelActivityInstance(). But I found nrOfActiveInstance didn’t change.
Did I use the right function? Or should I modify nrOfActiveInstance by myself?
Hi @young , thank you for your question and welcome to the community. Have you checked that you are targeting the inner activity itself and not the multi-instance body? There is a good section in the docs on this topic:
The engine will take care of updating the variables associated with the multi-instance body such as nrOfActiveInstance, so you should not have to touch those. Could you share more of your modification code and maybe a snippet of your model too? This will help the community answer your question more quickly.
hi herrier, I have read the doc about the modification, but shows how to add an instance for multi-instance task…
Here is the details about my question:
I have draw a model just like the one in the doc, only a parallel user task in it.
And I start the process with 3 instance of that parallel user task.
Then I see that in act_ru_variables table, created 3 vars:
I believe there is nothing wrong with these values.
Yes, only nrOfActiveInstances should decrease, as one instance has been canceled. nrOfInstances is set when the execution reaches the activity marked as multi-instance (indicating the number of iterations). nrOfCompletedInstances should only increase if an instance is completed normally, but in this case, it was canceled.