After running runtimeService().deleteProcessInstance(processInstance.getId()) to delete the parent process instance, the CallActivity subprocessInstance query is null
MoringMartin opened this issue · 1 comments
MoringMartin commented
After running runtimeService().deleteProcessInstance(processInstance.getId()) to delete the parent process instance, the CallActivity subprocessInstance query is null
After running runtimeService().deleteProcessInstance(processInstance.getId()) to delete the parent process instance, the CallActivity subprocessInstance i can query
Code
public MetaWorkData taskRefuse(MetaWorkData metaWorkData, Map<String, Object> variables) {
taskComplete(metaWorkData, variables);
MetaWorkFlow metaWorkFlow = workFlowService.queryById(metaWorkData.getFlowId());
MetaWorkFlowAssert.EMPTY_META_WORK_FLOW.isNotBlank(metaWorkFlow);
List<MetaWorkFlow> allWorkFlows = new ArrayList<>();
collectParentAndChildWorkflows(metaWorkFlow, allWorkFlows);
allWorkFlows.forEach(flow -> {
String processInstanceId = flow.getThirdBusinessKey();
ProcessInstance processInstance = processEngine.getRuntimeService()
.createProcessInstanceQuery()
.processInstanceId(processInstanceId)
.singleResult();
MetaWorkFlowAssert.FLOWABLE_PROCESS_INSTANCE_EMPTY.isNotBlank(processInstance);
processEngine.getRuntimeService().deleteProcessInstance(processInstance.getId(), "Fail the audit");
doAfterProcessInstanceChange(flow, FlowStatusTypeEnum.REFUSED);
});
return metaWorkData;
}
Additional context
This was using Flowable ### 7.1.0-SNAPSHOT.
filiphr commented
This works as designed. When you delete a parent process, it's children will also be deleted.
e.g. if you have Parent Process -> Call Activity Process. When you delete the parent process, the call activity process will also be deleted.