How to set "bpmn:TimerEventDefinition" as type of an element?

Currently, when I create this “timer” element its default type is “bpmn:IntermediateCatchEvent”.
But when I go to the eventDefinitions, there is a moddle object, containing a different type - “bpmn:TimerEventDefinition”.
Is there any way to set the timer element’s main type as “bpmn:TimerEventDefinition”?
If I need to create a custom type, could you please explain how?
I went through the example provided, but not sure how to apply it in my project.
image

This is in line with the BPMN 2.0 specification (see page 274). Timer Events consist of a base element (e.g., bpmn:StartEvent) and a child TimerEventDefinition.
Example:

    <bpmn:startEvent id="Event_0li3rwq">
      <bpmn:timerEventDefinition id="TimerEventDefinition_0856547" />
    </bpmn:startEvent>

Therefore in bpmn-js you create them following along that structure, example:

 const timerStartEvent = elementFactory.createShape({
    type: 'bpmn:StartEvent',
    eventDefinitionType: 'bpmn:TimerEventDefinition'
  });

Therefore your observation is correct and can not be changed: the main shape has a type like for example bpmn:StartEvent and it has an attribute eventDefinitionType of bpmn:TimerEventDefinition.

2 Likes

How to set eventDefinitionType’s property
like this

<bpmn:startEvent id="Event_0li3rwq">
   <bpmn:timerEventDefinition id=\"TimerEventDefinition_0e8o6xe\">
       <bpmn:timeDuration xsi:type=\"bpmn:tFormalExpression\">PT3M</bpmn:timeDuration>
   </bpmn:timerEventDefinition>
</bpmn:startEvent>