CMMN: human task activated but not expected


#1

Hi all,

I have designed a case management model with Flowable Modeler. Following an extract:
cmmn-extract
with following properties:

  • the transition event from my both events (user, timer) to sentries of milestone are declared as ‘occur’,
  • the transition event from the milestone to the human task is declared as ‘complete’,
  • no specific condition on sentries.

When I execute this case with Flowable Task, the task “Take out dirty sheets and towels” is available just after to have created a case instance. I expect that I must fire the user event before to see the human task, no ? Perhaps something is wrong but I don’t see what. Please, can you help me to point my misunderstood ?

Thank a lot,
Christophe


#2

Hi all,

Nobody has any idea ? Is it correct in a CMMN way and is the problem due to an issue in Flowable CMMN engine, or did I model something wrong ?

Thanks for your help
Christophe


#3

That definitely shouldn’t happen here, the sentry should guard that.

Can you paste the CMMN XML? I have a suspicion you might have hit a bug where the sentry didn’t connect properly in the modeler.


#4

Hi @joram,

Here after the full CMMN XML. Thanks for your help.

Regards,
Christophe


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:flowable="http://flowable.org/cmmn" xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI" xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC" xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI" targetNamespace="http://www.flowable.org/casedef">
  <case id="hotelRoomCleaning" name="Hotel room cleaning" flowable:initiatorVariableName="initiator">
    <casePlanModel id="casePlanModel" flowable:includeInStageOverview="false">
      <planItem id="planItem1" name="Room unused for one month" definitionRef="sid-60BF3EA5-5712-4926-BC5C-C97511E82E43"></planItem>
      <planItem id="planItem2" name="Guest has left hotel" definitionRef="sid-4728EEFB-4415-4965-995C-E7DB8A1319E9"></planItem>
      <planItem id="planItem3" name="Room must be cleaned" definitionRef="sid-F2EB3CAD-5DE4-4154-B55B-2EBDF3A21560">
        <entryCriterion id="sid-38917D29-C2BE-4CE2-8E35-9983A61906D5" sentryRef="sentry9"></entryCriterion>
      </planItem>
      <planItem id="planItem4" name="Take out dirty sheets and towels" definitionRef="sid-47635097-3B9E-4D8A-A274-F00D9A2A6788"></planItem>
      <planItem id="planItem5" name="Put clean towels and sheets" definitionRef="sid-1B13174E-D55E-4CEC-B701-443D011D6057">
        <entryCriterion id="sid-D0221679-8CC8-4C86-8EEF-E40C1688D663" sentryRef="sentry2"></entryCriterion>
      </planItem>
      <planItem id="planItem6" name="Put new flowers (if flowers are old)" definitionRef="sid-BEAAF2D5-2215-48CA-AC59-0EF0113D2204">
        <entryCriterion id="sid-2A39CE55-54CD-42D9-9B99-671A1243BE79" sentryRef="sentry1"></entryCriterion>
      </planItem>
      <planItem id="planItem7" name="Room is ready for new guests" definitionRef="sid-A4785D94-FFEF-43C6-9676-F0026FE0F82E">
        <entryCriterion id="sid-401E9C55-C190-43D8-8221-53BC4AD9A08B" sentryRef="sentry5"></entryCriterion>
      </planItem>
      <planItem id="planItem8" name="Set room as cleaned" definitionRef="sid-D6EED47E-68BF-401B-85D9-23EA163653E2">
        <entryCriterion id="sid-77200D97-EEFD-47E9-9BB1-C272337830C0" sentryRef="sentry7"></entryCriterion>
      </planItem>
      <planItem id="planItem9" name="Vacuum &amp; clean room" definitionRef="sid-9AF62D7C-717F-4BA2-AAA2-05CE617488E0">
        <entryCriterion id="sid-5587C5F6-BF77-4BB8-8B45-E5AA249D70BC" sentryRef="sentry4"></entryCriterion>
      </planItem>
      <sentry id="sentry9">
        <planItemOnPart id="sentryOnPart1" sourceRef="planItem2">
          <standardEvent>occur</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry2">
        <planItemOnPart id="sentryOnPart2" sourceRef="planItem9">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry1">
        <planItemOnPart id="sentryOnPart3" sourceRef="planItem9">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry5">
        <planItemOnPart id="sentryOnPart4" sourceRef="planItem6">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
        <planItemOnPart id="sentryOnPart5" sourceRef="planItem5">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry7">
        <planItemOnPart id="sentryOnPart6" sourceRef="planItem7">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry4">
        <planItemOnPart id="sentryOnPart7" sourceRef="planItem4">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <timerEventListener id="sid-60BF3EA5-5712-4926-BC5C-C97511E82E43" name="Room unused for one month">
        <timerExpression><![CDATA[P1M]]></timerExpression>
      </timerEventListener>
      <userEventListener id="sid-4728EEFB-4415-4965-995C-E7DB8A1319E9" name="Guest has left hotel"></userEventListener>
      <milestone id="sid-F2EB3CAD-5DE4-4154-B55B-2EBDF3A21560" name="Room must be cleaned"></milestone>
      <humanTask id="sid-47635097-3B9E-4D8A-A274-F00D9A2A6788" name="Take out dirty sheets and towels" flowable:assignee="${initiator}">
        <extensionElements>
          <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
        </extensionElements>
      </humanTask>
      <humanTask id="sid-1B13174E-D55E-4CEC-B701-443D011D6057" name="Put clean towels and sheets" flowable:assignee="${initiator}">
        <extensionElements>
          <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
        </extensionElements>
      </humanTask>
      <humanTask id="sid-BEAAF2D5-2215-48CA-AC59-0EF0113D2204" name="Put new flowers (if flowers are old)" flowable:assignee="${initiator}">
        <extensionElements>
          <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
        </extensionElements>
      </humanTask>
      <milestone id="sid-A4785D94-FFEF-43C6-9676-F0026FE0F82E" name="Room is ready for new guests"></milestone>
      <task id="sid-D6EED47E-68BF-401B-85D9-23EA163653E2" name="Set room as cleaned" flowable:type="script" flowable:scriptFormat="Groovy">
        <extensionElements>
          <flowable:field name="script">
            <flowable:string><![CDATA[println "Room " + (planItemInstance.getVariable("roomNumber") != null ? roomNumber + " " : "") + "is ready !!"
planItemInstance.setVariable("roomAvailable", true)]]></flowable:string>
          </flowable:field>
        </extensionElements>
      </task>
      <humanTask id="sid-9AF62D7C-717F-4BA2-AAA2-05CE617488E0" name="Vacuum &amp; clean room" flowable:assignee="${initiator}">
        <extensionElements>
          <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
        </extensionElements>
      </humanTask>
    </casePlanModel>
  </case>
</definitions>

#5

Looking at the xml, the sentry doesn’t seem to be connected indeed:

<planItem id="planItem4" name="Take out dirty sheets and towels" definitionRef="sid-47635097-3B9E-4D8A-A274-F00D9A2A6788"></planItem>

If it would have one, it would look like the other task:

<planItem id="planItem3" name="Room must be cleaned" definitionRef="sid-F2EB3CAD-5DE4-4154-B55B-2EBDF3A21560">
        <entryCriterion id="sid-38917D29-C2BE-4CE2-8E35-9983A61906D5" sentryRef="sentry9"></entryCriterion>
      </planItem>

Can you open up the model and try to reconnect it to the task, export again and make sure the xml element for that tasks contains the the entryCriterion?


#6

Thanks Joram,

Using Flowable Modeler, it is needed to be precise when moving sentry. It should be put on the green line. If you move the sentry on task but without green line, the connection is not done.

After to fix the CMMN XML as you told me, the human task is no more automatically activated when creating a case instance. Right !

But now, if I fire the user event, no human task is available. I don’t understand why, all seems ok for me ? Can you help me again ? Here after the CMMN XML updated.

Regards,
Christophe

<definitions ...>
  <case id="hotelRoomCleaning" name="Hotel room cleaning" flowable:initiatorVariableName="initiator">
    <casePlanModel id="casePlanModel" flowable:includeInStageOverview="false">
      <planItem id="planItem1" name="Room unused for one month" definitionRef="sid-C1346042-B9CE-4D8C-A872-45504D833005"></planItem>
      <planItem id="planItem2" name="Guest has left hotel" definitionRef="sid-56E53F7D-4C23-4CAC-BB75-1A716AD79360"></planItem>
      <planItem id="planItem3" name="Room must be cleaned" definitionRef="sid-46DF90F3-C7C0-400B-A9F8-A0BEDDAE43D6">
        <entryCriterion id="sid-53D48182-7459-4909-892C-833DB2C8BC95" sentryRef="sentry7"></entryCriterion>
        <entryCriterion id="sid-74B725BC-C097-4BBC-958F-EAD587982B46" sentryRef="sentry8"></entryCriterion>
      </planItem>
      <planItem id="planItem4" name="Take out dirty sheets and towels" definitionRef="sid-D09E9A97-AF98-4FF9-976C-9F7C785DCF9E">
        <entryCriterion id="sid-4F336A2B-7C4A-410E-9BBA-4C1FA5245846" sentryRef="sentry5"></entryCriterion>
      </planItem>
      <planItem id="planItem5" name="Put clean towels and sheets" definitionRef="sid-F0E47260-E166-41A7-B932-0047B8756EC2">
        <entryCriterion id="sid-9AAAE655-C305-4C35-B6AE-55923345CBFB" sentryRef="sentry6"></entryCriterion>
      </planItem>
      <planItem id="planItem6" name="Vacuum &amp; clean room" definitionRef="sid-561EBE4C-62C7-4CA1-8166-268008AC88A5">
        <entryCriterion id="sid-7ED88131-F4DF-4576-8982-6588AB8E405F" sentryRef="sentry1"></entryCriterion>
      </planItem>
      <planItem id="planItem7" name="Put new flowers (if flowers are old)" definitionRef="sid-E68CF652-4E19-49C8-AE4D-72D45102E626">
        <entryCriterion id="sid-6716D4BA-5AAF-4348-830D-0318610636C9" sentryRef="sentry2"></entryCriterion>
      </planItem>
      <planItem id="planItem8" name="Room is ready for new guests" definitionRef="sid-E76CAA66-ECF2-4613-B7E6-0E7B0403A186">
        <entryCriterion id="sid-7E5FBB47-53D7-4F71-B77D-44F67C7D68BB" sentryRef="sentry3"></entryCriterion>
      </planItem>
      <planItem id="planItem9" name="Set room as cleaned" definitionRef="sid-CF5E5A2A-4B8E-4D07-8FCE-1624F9E0E448">
        <entryCriterion id="sid-AFA5C764-D88E-4948-9A5A-C6899D2C9505" sentryRef="sentry4"></entryCriterion>
      </planItem>
      <sentry id="sentry7">
        <planItemOnPart id="sentryOnPart1" sourceRef="planItem2">
          <standardEvent>occur</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry8">
        <planItemOnPart id="sentryOnPart2" sourceRef="planItem1">
          <standardEvent>occur</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry5">
        <planItemOnPart id="sentryOnPart3" sourceRef="planItem3">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry6">
        <planItemOnPart id="sentryOnPart4" sourceRef="planItem6">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry1">
        <planItemOnPart id="sentryOnPart5" sourceRef="planItem4">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry2">
        <planItemOnPart id="sentryOnPart6" sourceRef="planItem6">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry3">
        <planItemOnPart id="sentryOnPart7" sourceRef="planItem7">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
        <planItemOnPart id="sentryOnPart8" sourceRef="planItem5">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry4">
        <planItemOnPart id="sentryOnPart9" sourceRef="planItem8">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>
      <sentry id="sentry9">
        <ifPart>
          <condition><![CDATA[${caseInstance.getVariable('roomAvailable') != null && roomAvailable}]]></condition>
        </ifPart>
      </sentry>
      <timerEventListener id="sid-C1346042-B9CE-4D8C-A872-45504D833005" name="Room unused for one month">
        <timerExpression><![CDATA[P1M]]></timerExpression>
      </timerEventListener>
      <userEventListener id="sid-56E53F7D-4C23-4CAC-BB75-1A716AD79360" name="Guest has left hotel"></userEventListener>
      <milestone id="sid-46DF90F3-C7C0-400B-A9F8-A0BEDDAE43D6" name="Room must be cleaned"></milestone>
      <humanTask id="sid-D09E9A97-AF98-4FF9-976C-9F7C785DCF9E" name="Take out dirty sheets and towels" flowable:assignee="${initiator}">
        <extensionElements>
          <modeler:flowable-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:flowable-idm-initiator>
        </extensionElements>
      </humanTask>
      <humanTask id="sid-F0E47260-E166-41A7-B932-0047B8756EC2" name="Put clean towels and sheets" flowable:assignee="${initiator}">
        <extensionElements>
          <modeler:flowable-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:flowable-idm-initiator>
        </extensionElements>
      </humanTask>
      <humanTask id="sid-561EBE4C-62C7-4CA1-8166-268008AC88A5" name="Vacuum &amp; clean room" flowable:assignee="${initiator}">
        <extensionElements>
          <modeler:flowable-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:flowable-idm-initiator>
        </extensionElements>
      </humanTask>
      <humanTask id="sid-E68CF652-4E19-49C8-AE4D-72D45102E626" name="Put new flowers (if flowers are old)" flowable:assignee="${initiator}">
        <extensionElements>
          <modeler:flowable-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:flowable-idm-initiator>
        </extensionElements>
      </humanTask>
      <milestone id="sid-E76CAA66-ECF2-4613-B7E6-0E7B0403A186" name="Room is ready for new guests"></milestone>
      <task id="sid-CF5E5A2A-4B8E-4D07-8FCE-1624F9E0E448" name="Set room as cleaned" flowable:type="script" flowable:scriptFormat="groovy">
        <extensionElements>
          <flowable:field name="script">
            <flowable:string><![CDATA[println "Room " + (planItemInstance.getVariable("roomNumber") != null ? roomNumber + " " : "") + "is ready !!"
planItemInstance.setVariable("roomAvailable", true)]]></flowable:string>
          </flowable:field>
        </extensionElements>
      </task>
      <exitCriterion id="sid-8073E7B6-17B5-4BF2-9FDE-ECEBF893A0BD" sentryRef="sentry9"></exitCriterion>
    </casePlanModel>
  </case>