Hi,
I use the Java API.
I’m trying to implement the following scenario:
create a new process instance that will start the execution from a certain activity.
when I try to do the following:
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(key, workflowExecutorId, globalInputs);
runtimeService.createProcessInstanceModification(processInstance.getId())
.startBeforeActivity(camunaActivityId)
.execute();
I receive two executions - one regular and one that starts from the camundaActivityId mentioned , I want to receive only onw execution that starts from the camundaActivityId, what is the right way to do so?
Thanks!
Maybe I didn’t understand his idea very well, but…
When you do a “processInstanceModification”, Camunda creates a kind of “clone” of that running instance, and initializes this copy in the activity you suggested with startBeforeActivity.
However, with this, the instance in which you “cloned” was not finalized… so theoretically you have 2 instances with the same data.
To do this, you will also have to add the “cancel” command to terminate the previous instance, which you “cloned”, canceling the instance that has the “transitionInstanceId”, which indicates that the instance in question was “cloned”.