AnsweredAssumed Answered

Multi instance user task with empty collection

Question asked by felipe1 on Sep 11, 2014
Latest reply on Sep 17, 2014 by jbarrez
Hi!

I have a user task with multi instance characteristics,


                <userTask
         id="my-task"
         activiti:assignee="#{assignee}"
         activiti:formKey="form.xhtml"
         name="My Task">

         <multiInstanceLoopCharacteristics
            id="MultiInstanceLoopCharacteristics_1"
            activiti:collection="#{myBean.getListOfApprovers}"
            activiti:elementVariable="assignee">
            <completionCondition
               xsi:type="tFormalExpression"
               id="FormalExpression_1">
               ${approved == false}
            </completionCondition>
         </multiInstanceLoopCharacteristics>
      </userTask>


It works great if <b>myBean.getListOfApprovers</b> returns 1 or more elements, however if the list is empty I get a "Invalid number of instances: must be positive integer value, but was 0".

I would like to skip that user task if the list returns 0, what is the best way to achieve that?

Thanks!

Outcomes