Currently, I have the one running case instance which has only one task.
eg:
At this stage, we tried to inject a stage into the running case Instance. The stage has set “repetition” value to true, also set the flowable:maxInstanceCount=“1”.
eg: case model to be injected
Case definition:
<case id="TestInject" name="TestInject" flowable:initiatorVariableName="initiator"> <casePlanModel id="casePlanModel" flowable:formFieldValidation="true"> <planItem id="planItem2" name="stage1" definitionRef="stage1"> <itemControl> <repetitionRule flowable:counterVariable="repetitionCounter" flowable:maxInstanceCount="1"> </repetitionRule> </itemControl> </planItem> <stage id="stage1" name="stage1"> <planItem id="planItem1" name="task1" definitionRef="task1"></planItem> <humanTask id="task1" name="task1" flowable:assignee="${initiator}" flowable:formFieldValidation="true"> <extensionElements> <modeler:flowable-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:flowable-idm-initiator> </extensionElements> </humanTask> </stage> </casePlanModel> </case>
We are able to inject this stage in the above running case instance using case ‘dynamicCmmnService’. After injection, we are able to get the plan items like myTask1, stage1, task1.
But when try to complete the task ‘task1’ getting Null Pointer exception.
java.lang.NullPointerException
at org.flowable.cmmn.engine.impl.listener.PlanItemLifeCycleListenerUtil.callLifecycleListeners(PlanItemLifeCycleListenerUtil.java:38)
at org.flowable.cmmn.engine.impl.agenda.operation.AbstractMovePlanItemInstanceToTerminalStateOperation.run(AbstractMovePlanItemInstanceToTerminalStateOperation.java:68)
at org.flowable.cmmn.engine.impl.interceptor.CmmnCommandInvoker.executeOperations(CmmnCommandInvoker.java:65)
at org.flowable.cmmn.engine.impl.interceptor.CmmnCommandInvoker.execute(CmmnCommandInvoker.java:51)
Is it possible inject stage which is repeatable? Here we need to inject a stage which is repeatable so that we can trigger the stage again based the requirements.