Change parent of multi instance subprocess

I have a multi instance subprocess in my workflow. There are 2 user activities in this multi instance subprocess.

In my first run, there are 3 instances created for the subprocess and 3 of them are waiting in first user activity. In my second run, there are 2 instances created for the subprocess and 2 of them are waiting in second user activity.

Now I want to move one of the subprocess instances from first run to second run and it should resume from first user activity. How do I do this? Can I update the parent process id of this subprocess instance to second run’s parent ID? Will this work?

Hi @anigeorge,

you should have a look at the process instance migration feature. There you can move a process instance according to your needs.

Best,
Johannes

1 Like

Its not exactly migration. I wan to just move a subprocess instance from one parent instance to another parent instance. So in fact I want to change the parent instance id of this sbuprocess instance. Is this possible?

You can use modification to cancel that instance and restart it in (more or less) the same state.

But I want to move a subprocess instance. So I will have to change the parent instance id of the subprocess instance right?

Yes, the thing is: This is not possible.

So its not possible at all to move a subprocess instance from one parent instance to another parent instance of the same process definition?

Yes, unless you modify database entries at your own risk.

Is there any work around available for this? Like cancel the subprocess instance using https://docs.camunda.org/manual/7.6/user-guide/process-engine/process-instance-modification/#start-activities-with-interrupting-canceling-semantics

Then inside cancel evaluation event subprocess, get the subprocess instance entry and add that to another instance by using https://docs.camunda.org/manual/7.6/user-guide/process-engine/process-instance-modification/#modify-multi-instance-activity-instances

Is this possible? If so, can I keep the current state of the subprocess instance during this move? What do you think?

Can you suggest a work around for this? Our project design is stuck at here. This is one of the major functionalities mentioned in the requirement.

No, nothing that I haven’t mentioned in this thread already. Perhaps you should design the processes in another way that does not require this functionality, or BPMN/Camunda is not the right tool for you.

Cheers,
Thorben