**
public MetaWorkData taskRefuse(MetaWorkData metaWorkData, Map<String, Object> variables) {
taskComplete(metaWorkData, variables);
MetaWorkFlow metaWorkFlow = workFlowService.queryById(metaWorkData.getFlow().getId());
MetaWorkFlowAssert.EMPTY_META_WORK_FLOW.isNotBlank(metaWorkFlow);
List<MetaWorkFlow> allWorkFlows = new ArrayList<>();
collectParentAndChildWorkflows(metaWorkFlow, allWorkFlows);
MetaWorkFlow topLevelParent = findTopLevelParent(metaWorkFlow);
String processInstanceId = topLevelParent.getThirdBusinessKey();
HistoricProcessInstance historicProcessInstance = processEngine.getHistoryService()
.createHistoricProcessInstanceQuery()
.processInstanceId(processInstanceId)
.singleResult();
MetaWorkFlowAssert.FLOWABLE_PROCESS_INSTANCE_EMPTY.isNotBlank(historicProcessInstance);
processEngine.getRuntimeService().deleteProcessInstance(processInstanceId, "Fail the audit");
allWorkFlows.forEach(flow -> {
doAfterProcessInstanceChange(flow, FlowStatusTypeEnum.REFUSED);
});
return metaWorkData;
}
**
when do deleteProcessInstance::org.flowable.common.engine.api.FlowableObjectNotFoundException: No process instance found for id ‘xxxxx’