flowable-engine
flowable-engine copied to clipboard
after call method runtimeService.deleteMultiInstanceExecution, then got exception while call method taskService.complete
Describe the bug first, the exception is 'Could not execute inner activity behavior of multi instance behavior'
then, the operation is
- multiInstanceLoopCharacteristics isSequential="true";
- call method runtimeService.addMultiInstanceExecution to add some executions;
- and call method runtimeService.deleteMultiInstanceExecution to delete on execution;
- call method taskService.complete to approve the task;
then got the error.
the value of variables nrOfActiveInstances/nrOfCompletedInstances didn't change.
Expected behavior multiInstance can add or delete execution, and can complete task.
Code
<userTask id="sid-C98B5E1F-67C8-4200-BAC8-CD8FF4D86DB8" name="人事处理" flowable:assignee="${user}">
<extensionElements>
<flowable:taskListener event="all" delegateExpression="${defaultTaskListener}"/>
</extensionElements>
<multiInstanceLoopCharacteristics isSequential="true" flowable:collection="${users}" flowable:elementVariable="user"/>
</userTask>
runtimeService.setVariable(defaultTask.getExecutionId(), "users", users);
// 第二个参数取巧,procInstId恰好是所有execution的parentId
users.forEach(userId -> runtimeService.addMultiInstanceExecution(workflowEventBO.getElementId(), workflowEventBO.getProcessInstanceId(), Collections.singletonMap("user", userId)));
// 减签(删除默认处理人对应数据)
runtimeService.deleteMultiInstanceExecution(defaultTask.getExecutionId(), true);
Additional context the exception happen at MultiInstanceActivityBehavior.executeOriginalBehavior.while.loopCounter