I would like to ask how to migrate the process instance, which definition has call activity with expression key.
For example, I have two BPMNs, one called self and the other children.
When I update children, try to migrate children and self file, but I get an error.
runtimeService.createProcessInstanceMigrationBuilder()
.migrateToProcessDefinition(parentProcessDefinition.id)
.addActivityMigrationMapping(ActivityMigrationMapping.createMappingFor("startActivity", "startActivity").inSubProcessOfCallActivityId("callSelfActivity"))
.migrate(processInstance.id)
BPMN self.bpmn20.xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
<process id="SELF" name="SELF" isExecutable="true">
<startEvent id="startEvent"/>
<sequenceFlow id="flow1" sourceRef="startEvent" targetRef="startActivity"/>
<userTask id="startActivity" name="startActivity"/>
<sequenceFlow id="flow2" sourceRef="startActivity" targetRef="callChildrenActivity"/>
<callActivity id="callChildrenActivity" name="Call Children" calledElement="${CHILDREN}" flowable:calledElementType="key" flowable:inheritVariables="true" flowable:fallbackToDefaultTenant="false"/>
<sequenceFlow id="flow9" sourceRef="callChildrenActivity" targetRef="endevent"/>
<endEvent id="endevent"/>
</process>
</definitions>
BPMN children.bpmn20.xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
<process id="CHILDREN" name="CHILDREN" isExecutable="true">
<startEvent id="startEvent"/>
<sequenceFlow id="flow1" sourceRef="startEvent" targetRef="endInstance"/>
<userTask id="endInstance" name="endInstance"/>
<sequenceFlow id="flow9" sourceRef="endInstance" targetRef="endevent"/>
<endEvent id="endevent"/>
</process>
</definitions>
When I update Chidren.BPMN and try to migrate children.BPMN and self.bpmn.
But for self.bpmn file, it will show the following error.
Caused by: org.flowable.common.engine.api.FlowableException: Call activity 'callChildrenActivity' has a different called element in the new model. It must be mapped explicitly for migration (or all its child activities)
at org.flowable.engine.impl.migration.ProcessInstanceMigrationManagerImpl.prepareChangeStateBuilders(ProcessInstanceMigrationManagerImpl.java:482)
at org.flowable.engine.impl.migration.ProcessInstanceMigrationManagerImpl.doMigrateProcessInstance(ProcessInstanceMigrationManagerImpl.java:353)
at org.flowable.engine.impl.migration.ProcessInstanceMigrationManagerImpl.migrateProcessInstance(ProcessInstanceMigrationManagerImpl.java:316)
at org.flowable.engine.impl.cmd.ProcessInstanceMigrationCmd.execute(ProcessInstanceMigrationCmd.java:84)
at org.flowable.engine.impl.cmd.ProcessInstanceMigrationCmd.execute(ProcessInstanceMigrationCmd.java:26)
at org.flowable.engine.impl.interceptor.CommandInvoker$1.run(CommandInvoker.java:51)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:93)
at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72)
at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56)
at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:72)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.engine.impl.RuntimeServiceImpl.migrateProcessInstance(RuntimeServiceImpl.java:772)
at org.flowable.engine.impl.migration.ProcessInstanceMigrationBuilderImpl.migrate(ProcessInstanceMigrationBuilderImpl.java:96)
at com.oursky.flowable.migrations.migrations.test_2.migrateProcessInstance(test_2.kt:71)