flowable-engine icon indicating copy to clipboard operation
flowable-engine copied to clipboard

after call method runtimeService.deleteMultiInstanceExecution, then got exception while call method taskService.complete

Open hedong12321 opened this issue 4 years ago • 0 comments

Describe the bug first, the exception is 'Could not execute inner activity behavior of multi instance behavior'

then, the operation is

  1. multiInstanceLoopCharacteristics isSequential="true";
  2. call method runtimeService.addMultiInstanceExecution to add some executions;
  3. and call method runtimeService.deleteMultiInstanceExecution to delete on execution;
  4. 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

hedong12321 avatar Nov 30 '21 10:11 hedong12321