bpmnServer / bpmn-server

BPMN 2.0 server for Node.js , providing modeling, execution, persistence and monitoring for Workflow. along with sample UI. Intended to be developers workbench for BPMN 2.0
MIT License
186 stars 48 forks source link

Subprocess Signal messes up Data #232

Open kvdinker opened 2 days ago

kvdinker commented 2 days ago

Hi,

Upon further testing with subprocesses, I found an issue with attached signal events. I created a small flow to show the current problem. In our example, we can enter names that are stored in the general instance data or in the sub-process data. However, if we trigger the signal event in our sub-process, the next user task stores the values in our sub-process data and not in the general instance data.

Normal Flow:

image

Throw Signal Flow:

image

Thanks

Code:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
  <bpmn2:process id="Process_1" isExecutable="false">
    <bpmn2:startEvent id="StartEvent_1">
      <bpmn2:outgoing>Flow_02bdzyz</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:subProcess id="subprocess" name="SubProcess">
      <bpmn2:incoming>Flow_02bdzyz</bpmn2:incoming>
      <bpmn2:outgoing>Flow_1d1d6of</bpmn2:outgoing>
      <bpmn2:startEvent id="Event_01brpgb">
        <bpmn2:outgoing>Flow_0d9uawg</bpmn2:outgoing>
      </bpmn2:startEvent>
      <bpmn2:endEvent id="Event_089l7c3">
        <bpmn2:incoming>Flow_12yn9ys</bpmn2:incoming>
      </bpmn2:endEvent>
      <bpmn2:sequenceFlow id="Flow_12yn9ys" sourceRef="get_subprocess_name" targetRef="Event_089l7c3" />
      <bpmn2:sequenceFlow id="Flow_0d9uawg" sourceRef="Event_01brpgb" targetRef="get_subprocess_name" />
      <bpmn2:userTask id="get_subprocess_name" name="Get Subprocess Name">
        <bpmn2:extensionElements>
          <camunda:formData>
            <camunda:formField id="SubprocessName" label="Subprocess Name" type="string" defaultValue="sub" />
          </camunda:formData>
        </bpmn2:extensionElements>
        <bpmn2:incoming>Flow_0d9uawg</bpmn2:incoming>
        <bpmn2:outgoing>Flow_12yn9ys</bpmn2:outgoing>
      </bpmn2:userTask>
    </bpmn2:subProcess>
    <bpmn2:sequenceFlow id="Flow_02bdzyz" sourceRef="StartEvent_1" targetRef="subprocess" />
    <bpmn2:sequenceFlow id="Flow_1d1d6of" sourceRef="subprocess" targetRef="get_Name" />
    <bpmn2:endEvent id="Event_06lcqlo">
      <bpmn2:incoming>Flow_1pehqz9</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:sequenceFlow id="Flow_1pehqz9" sourceRef="get_Name" targetRef="Event_06lcqlo" />
    <bpmn2:userTask id="get_Name" name="Get Name">
      <bpmn2:extensionElements>
        <camunda:formData>
          <camunda:formField id="name" label="Name" type="string" defaultValue="test" />
        </camunda:formData>
      </bpmn2:extensionElements>
      <bpmn2:incoming>Flow_1d1d6of</bpmn2:incoming>
      <bpmn2:incoming>Flow_0kqhg1n</bpmn2:incoming>
      <bpmn2:outgoing>Flow_1pehqz9</bpmn2:outgoing>
    </bpmn2:userTask>
    <bpmn2:boundaryEvent id="Event_0xh37m9" name="Intercept" attachedToRef="subprocess">
      <bpmn2:outgoing>Flow_0kqhg1n</bpmn2:outgoing>
      <bpmn2:signalEventDefinition id="SignalEventDefinition_174kgf0" signalRef="Signal_0rha8r9" />
    </bpmn2:boundaryEvent>
    <bpmn2:sequenceFlow id="Flow_0kqhg1n" sourceRef="Event_0xh37m9" targetRef="get_Name" />
  </bpmn2:process>
  <bpmn2:signal id="Signal_0rha8r9" name="intercept" />
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNEdge id="Flow_02bdzyz_di" bpmnElement="Flow_02bdzyz">
        <di:waypoint x="578" y="258" />
        <di:waypoint x="650" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1d1d6of_di" bpmnElement="Flow_1d1d6of">
        <di:waypoint x="1000" y="280" />
        <di:waypoint x="1130" y="280" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1pehqz9_di" bpmnElement="Flow_1pehqz9">
        <di:waypoint x="1230" y="280" />
        <di:waypoint x="1362" y="280" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0kqhg1n_di" bpmnElement="Flow_0kqhg1n">
        <di:waypoint x="1018" y="190" />
        <di:waypoint x="1210" y="190" />
        <di:waypoint x="1210" y="240" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="Event_06lcqlo_di" bpmnElement="Event_06lcqlo">
        <dc:Bounds x="1362" y="262" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0jnhc7y_di" bpmnElement="get_Name">
        <dc:Bounds x="1130" y="240" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="542" y="240" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0drhydz_di" bpmnElement="subprocess" isExpanded="true">
        <dc:Bounds x="650" y="140" width="350" height="200" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_12yn9ys_di" bpmnElement="Flow_12yn9ys">
        <di:waypoint x="870" y="240" />
        <di:waypoint x="922" y="240" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0d9uawg_di" bpmnElement="Flow_0d9uawg">
        <di:waypoint x="726" y="240" />
        <di:waypoint x="770" y="240" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="Event_01brpgb_di" bpmnElement="Event_01brpgb">
        <dc:Bounds x="690" y="222" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_089l7c3_di" bpmnElement="Event_089l7c3">
        <dc:Bounds x="922" y="222" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0x9pifg_di" bpmnElement="get_subprocess_name">
        <dc:Bounds x="770" y="200" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1w6shca_di" bpmnElement="Event_0xh37m9">
        <dc:Bounds x="982" y="172" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1028" y="173" width="44" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>