Change a TimerEvent from Start to Intermediate

Hi,

I would like to let users modify a Timer bpmn:StartEvent to a Timer bpmn:IntermediateCatchEvent, while keeping the existing properties, such as the timerEventDefinition and the timeCycle inner property, for instance.

I am using the bpmnReplace module, which works fine to change the type, except that the timerEventDefinition is lost.

Based on Custom tags will lose when change task type and Change type of element but keep already set properties, it looks like I have to handle the moddleCopy.canCopyProperty event, but I don’t know how to proceed to copy the property.

From the latter post, I would like to know how the copyMyCustomProperty function should look like.

Could you please help me?
Many thanks!

Dear @bfredo123 ,

you can simply allow your users to replace a StartEvent by a TimerCatchEvent by adding your own replaceMenuProvider. For example:

// [...]
      if (isAny(element, ["bpmn:StartEvent"])) {
        entries = {
          ...entries,
          "replace-with-timer-catch": {
            label: "Timer Catch Event",
            className: "bpmn-icon-intermediate-event-catch-timer",
            action: function () {
              return self.replaceElement(element, {
                type: "bpmn:IntermediateCatchEvent",
                eventDefinitionType: "bpmn:TimerEventDefinition"
              });
            }
          }
        };
      }
// [...]

See full example in this sandbox.

However, a StartEvent can by spec not have the properties (such as timeCycle). If it had a timerEventDefinition it would not be a StartEvent anymore but a TimerStartEvent. Notice that a TimerStartEvent in BPMN is defined as following:

    <bpmn:startEvent id="StartEvent_1">
      <bpmn:timerEventDefinition id="TimerEventDefinition_1navd2v" />
    </bpmn:startEvent>

Hence I belive your requirement to keep these properties is not possible by BPMN design.

Best
Max

Thank you @maxtru , I was confused by “bpmn-startEvent” which can also be a TimerStartEvent. Thanks for the clarification!