Boundary conditional event not triggered

Hi all,

I have a process like this:
image

And the collapsed SubProcess :

image

Task A have a form (formA) that the user must fill and optionally choose an outcome. Now I want that when the user chooses that outcome the “Boundary Conditional event” triggers to avoid the flow to go to Task B. I don’t want to add an exclusive gateway to evaluate the form outcome because the idea is to have a process that have multiple human tasks one after the other in that every one of them the user can choose that outcome that abort the whole flow to a exception one.

I’ve set the condition expression of the “Boundary Conditional Event” to ${form_formA_outcome == “testOutcome”} but the flow always run from Task A to Task B.

I’m using Flowable-modeler app only.

Thanks to all!

Could you provide process model or simple jUnit test please?
Martin

Sure, process model:

<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef"> <process id="testsub" name="testsub" isExecutable="true"> <startEvent id="startEvent1" flowable:formFieldValidation="true"></startEvent> <subProcess id="sid-5329B5A4-039C-43D6-A9B8-518851B152EA" name="SubProcess"> <startEvent id="sid-6C500D98-5A5B-4FB1-B570-203DBB4107E8" flowable:formFieldValidation="true"></startEvent> <userTask id="sid-97D24A19-C7BD-4468-B9DC-5D1DD4B97A72" name="Task A" flowable:assignee="$INITIATOR" flowable:formKey="A" flowable:formFieldValidation="true"> <extensionElements> <modeler:activiti-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-initiator> </extensionElements> </userTask> <sequenceFlow id="sid-4DC2B669-D46D-41C7-877E-F0B31E8995FC" sourceRef="sid-6C500D98-5A5B-4FB1-B570-203DBB4107E8" targetRef="sid-97D24A19-C7BD-4468-B9DC-5D1DD4B97A72"></sequenceFlow> <userTask id="sid-8695E290-AAA5-4E0B-9046-D130DD5674D0" name="Task B" flowable:assignee="$INITIATOR" flowable:formFieldValidation="true"> <extensionElements> <modeler:activiti-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-initiator> </extensionElements> </userTask> <sequenceFlow id="sid-DE6CE875-D3CB-471A-8A1B-B01582F8F295" sourceRef="sid-97D24A19-C7BD-4468-B9DC-5D1DD4B97A72" targetRef="sid-8695E290-AAA5-4E0B-9046-D130DD5674D0"></sequenceFlow> <endEvent id="sid-5C696F57-CF95-4790-8A8B-D56F4F04619C"></endEvent> <sequenceFlow id="sid-80110139-264C-4E9E-9538-72C566DBBCC2" sourceRef="sid-8695E290-AAA5-4E0B-9046-D130DD5674D0" targetRef="sid-5C696F57-CF95-4790-8A8B-D56F4F04619C"></sequenceFlow> </subProcess> <sequenceFlow id="sid-6118BA44-44B9-441C-86A2-1FFB7725B196" sourceRef="startEvent1" targetRef="sid-5329B5A4-039C-43D6-A9B8-518851B152EA"></sequenceFlow> <endEvent id="sid-1944E094-C7C7-4E0F-B178-0BCC31C616B9"></endEvent> <sequenceFlow id="sid-0182EE7C-5471-4395-9022-52F82A41D582" sourceRef="sid-5329B5A4-039C-43D6-A9B8-518851B152EA" targetRef="sid-1944E094-C7C7-4E0F-B178-0BCC31C616B9"></sequenceFlow> <userTask id="sid-83501BC3-1A33-435F-8E83-70AFB23F1C5F" name="Exception task" flowable:assignee="$INITIATOR" flowable:formFieldValidation="true"> <extensionElements> <modeler:activiti-idm-initiator xmlns:modeler="http://flowable.org/modeler"><![CDATA[true]]></modeler:activiti-idm-initiator> </extensionElements> </userTask> <endEvent id="sid-FFDD2729-9CD7-46C7-AE1F-7945C26F25DB"></endEvent> <sequenceFlow id="sid-C5A5F388-8C39-4EDB-8FDC-FAB428FF19EB" sourceRef="sid-83501BC3-1A33-435F-8E83-70AFB23F1C5F" targetRef="sid-FFDD2729-9CD7-46C7-AE1F-7945C26F25DB"></sequenceFlow> <sequenceFlow id="sid-73F9B8B2-1B17-448B-9DF6-645B72C88C4E" sourceRef="sid-C0F31C79-E496-401F-B368-8DFEA39F623C" targetRef="sid-83501BC3-1A33-435F-8E83-70AFB23F1C5F"></sequenceFlow> <boundaryEvent id="sid-C0F31C79-E496-401F-B368-8DFEA39F623C" attachedToRef="sid-5329B5A4-039C-43D6-A9B8-518851B152EA" cancelActivity="true"> <conditionalEventDefinition> <condition>${form_A_outcome == "Faltam elementos"}</condition> </conditionalEventDefinition> </boundaryEvent> </process>
<bpmndi:BPMNDiagram id="BPMNDiagram_testsub"> <bpmndi:BPMNPlane bpmnElement="testsub" id="BPMNPlane_testsub"> <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1"> <omgdc:Bounds height="30.0" width="30.0" x="105.0" y="255.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-5329B5A4-039C-43D6-A9B8-518851B152EA" id="BPMNShape_sid-5329B5A4-039C-43D6-A9B8-518851B152EA" isExpanded="false"> <omgdc:Bounds height="80.0" width="100.0" x="225.0" y="230.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-1944E094-C7C7-4E0F-B178-0BCC31C616B9" id="BPMNShape_sid-1944E094-C7C7-4E0F-B178-0BCC31C616B9"> <omgdc:Bounds height="28.0" width="28.0" x="370.0" y="256.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-83501BC3-1A33-435F-8E83-70AFB23F1C5F" id="BPMNShape_sid-83501BC3-1A33-435F-8E83-70AFB23F1C5F"> <omgdc:Bounds height="80.0" width="100.0" x="265.9741033293165" y="375.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-FFDD2729-9CD7-46C7-AE1F-7945C26F25DB" id="BPMNShape_sid-FFDD2729-9CD7-46C7-AE1F-7945C26F25DB"> <omgdc:Bounds height="28.0" width="28.0" x="450.0" y="401.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-C0F31C79-E496-401F-B368-8DFEA39F623C" id="BPMNShape_sid-C0F31C79-E496-401F-B368-8DFEA39F623C"> <omgdc:Bounds height="30.0" width="30.0" x="300.9741033293165" y="295.4419721172475"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="sid-73F9B8B2-1B17-448B-9DF6-645B72C88C4E" id="BPMNEdge_sid-73F9B8B2-1B17-448B-9DF6-645B72C88C4E"> <omgdi:waypoint x="315.9741033293165" y="325.39197044609057"></omgdi:waypoint> <omgdi:waypoint x="315.9741033293165" y="375.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-0182EE7C-5471-4395-9022-52F82A41D582" id="BPMNEdge_sid-0182EE7C-5471-4395-9022-52F82A41D582"> <omgdi:waypoint x="324.949999999934" y="270.0"></omgdi:waypoint> <omgdi:waypoint x="370.0" y="270.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-C5A5F388-8C39-4EDB-8FDC-FAB428FF19EB" id="BPMNEdge_sid-C5A5F388-8C39-4EDB-8FDC-FAB428FF19EB"> <omgdi:waypoint x="365.9241033293165" y="415.0"></omgdi:waypoint> <omgdi:waypoint x="450.0" y="415.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="sid-6118BA44-44B9-441C-86A2-1FFB7725B196" id="BPMNEdge_sid-6118BA44-44B9-441C-86A2-1FFB7725B196"> <omgdi:waypoint x="134.9499992392744" y="270.0"></omgdi:waypoint> <omgdi:waypoint x="225.0" y="270.0"></omgdi:waypoint> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> <bpmndi:BPMNDiagram id="BPMNDiagram_sid-5329B5A4-039C-43D6-A9B8-518851B152EA"> <bpmndi:BPMNPlane bpmnElement="sid-5329B5A4-039C-43D6-A9B8-518851B152EA" id="BPMNPlane_sid-5329B5A4-039C-43D6-A9B8-518851B152EA"> <bpmndi:BPMNShape bpmnElement="sid-6C500D98-5A5B-4FB1-B570-203DBB4107E8" id="BPMNShape_sid-6C500D98-5A5B-4FB1-B570-203DBB4107E8"> <omgdc:Bounds height="30.0" width="30.0" x="157.5" y="269.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="sid-97D24A19-C7BD-4468-B9DC-5D1DD4B97A72" id="BPMNShape_sid-97D24A19-C7BD-4468-B9DC-5D1DD4B97A72"> <omgdc:Bounds height="80.0" width="100.0" x="225.0" y="244.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="sid-4DC2B669-D46D-41C7-877E-F0B31E8995FC" id="BPMNEdge_sid-4DC2B669-D46D-41C7-877E-F0B31E8995FC"> <omgdi:waypoint x="187.44999826100909" y="284.0"></omgdi:waypoint> <omgdi:waypoint x="225.0" y="284.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNShape bpmnElement="sid-8695E290-AAA5-4E0B-9046-D130DD5674D0" id="BPMNShape_sid-8695E290-AAA5-4E0B-9046-D130DD5674D0"> <omgdc:Bounds height="80.0" width="100.0" x="390.0" y="244.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="sid-DE6CE875-D3CB-471A-8A1B-B01582F8F295" id="BPMNEdge_sid-DE6CE875-D3CB-471A-8A1B-B01582F8F295"> <omgdi:waypoint x="324.95000000000005" y="284.0"></omgdi:waypoint> <omgdi:waypoint x="390.0" y="284.0"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNShape bpmnElement="sid-5C696F57-CF95-4790-8A8B-D56F4F04619C" id="BPMNShape_sid-5C696F57-CF95-4790-8A8B-D56F4F04619C"> <omgdc:Bounds height="28.0" width="28.0" x="535.0" y="270.0"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="sid-80110139-264C-4E9E-9538-72C566DBBCC2" id="BPMNEdge_sid-80110139-264C-4E9E-9538-72C566DBBCC2"> <omgdi:waypoint x="489.949999999934" y="284.0"></omgdi:waypoint> <omgdi:waypoint x="535.0" y="284.0"></omgdi:waypoint> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>

Conditional events need to trigger execution or evaluate conditional events associated with the process instance. Without that you should always get task B.

see org.flowable.engine.test.bpmn.event.conditional.BoundaryConditionalEventTest

Regards
Martin

Can you please provide an example on how to do it trough Flowable-Modeler?

Many thanks Martin.

Hi Jota,
I would put a listener on task A complete event with the call to runtimeService.evaluateConditionalEvents(...).

Regards
Martin

Thanks martin, I’m almost there,

For my Task A I’ve added the following “Task Listener” (bellow image). Is it rigth?
However I think that the processinstance.getid() must be the parent subprocess. How can I get the ID of the parent subprocess?

implement a class listener

Sorry Martin, I don´t get it.

To trigger the boundary conditional event I need to use anything beside flowable-modeler?
Can you please send me an example on how to do it (process definition, or any print-screen)?

Thanks in advance.

Anyone can help me with this?

Hi Jotta.

I think runtimeService is not accessible by default in expressions. You can create a bean and it will be after that.
That’s why you could implement a TaskListener in a class which will do the job for you. Right above expression there is a place where you can put TaskListener implementation class name.

Does it make sense now?

Martin