Repetition flag and Cases

Hi all,

Trying to model (and execute) something with CMMN/Camunda that I am not sure if it is possible.
Need to model a case with several repeatable human tasks that need to be activated in parallel, i.e. I need to have several instances of each task that might be executed by different users. Any thoughts? examples?
By the way, I am not using a BPMN process because the sequence is not known in advance.

cheers

Hi @Toacy,

You can change the transition in which the repetition rule is evaluated by using the Camunda extension attribute named camunda:repeatOnStandardEvent 1. You could try to set the camunda:repeatOnStandardEvent to create and provide a repetition rule. This could look as follows

<humanTask id="HumanTask">
  <defaultControl>
    <repetitionRule camunda:repeatOnStandardEvent="create">
      <condition><![CDATA[${count < 10}]]></condition>
    </repetitionRule>
  </defaultControl>
</humanTask>

In that case 10 human tasks are created, which exists in parallel.

Note: You have to take care, that you have a condition which stops creating human tasks at a certain point (for example if there are already 10 tasks available - therefore you have to count the number of already created tasks), otherwise you would end in an infinite loop. As a result, you would get a StackOverflowException.

Cheers,
Roman

Hi @roman.smirnov

Thanks for the help.
The code worked fine and I just had to handle the create event to increment the variable. To be honest I was close to the same solution but using a different event.
Now I am trying to achieve the same results but using a sentry with a VariableOnPArt https://docs.camunda.org/manual/7.6/reference/cmmn11/sentry/. According to the documentation if I update the variable within another task, this will trigger the sentry evaluation. I am using caseExecution.setVariable(“count”, count) to update the variable count but the sentry does not move. Any thoughts?

cheers

Worked fine with the sentry and VariableOnPArt :slight_smile: The modeller doesn’t help though.

It’s a nice work around for the lack of events in cases.

cheers

Hi,

How can I create the event to increment count variable ?

Hi @carloborsoi,

You have to register a case execution listener 1, which listen to a specific event. Once the event occurs the listener is invoked and you can increment the count variable.

Cheers,
Roman

Hi @carloborsoi,

In my case I have attached a VariableOnPart (see below) to the sentry. In that case, every time you update XXXVar, you will enable that criterion.

    <cmmn:extensionElements>
      <camunda:variableOnPart variableName="XXXVar">          <camunda:variableEvent>update</camunda:variableEvent>

</camunda:variableOnPart>
</cmmn:extensionElements>

cheers