Set a default timerEventDefinition after creating a boundary event

Hi Rick,

timeDurations are stored as bpmn:FormalExpression in the bpmn.

    <bpmn:boundaryEvent id="Event_0kbxgp5" attachedToRef="Activity_1tay8vr">
      <bpmn:timerEventDefinition id="TimerEventDefinition_0bo9rh7">
        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">P2D</bpmn:timeDuration>
      </bpmn:timerEventDefinition>
    </bpmn:boundaryEvent>

Therefore you need to create such a FormalExpression first and set your desired value:

[...]
  const bpmnFactory = bpmnJS.get("bpmnFactory");

  const formalExpression = bpmnFactory.create("bpmn:FormalExpression", {
    body: "PT5M"
  });
  formalExpression.$parent = eventDefinition;

  eventDefinition.set("timeDuration", formalExpression);
[...]

Also see this thread.

Regards
Max

1 Like