How to create new element for event definition


#1

Hello guys,

In reference to this question

I want to extend start event element with message start event programmatically

I have start event element object and target element type and event definition

like

var target = {
      eventDefinitionType: "bpmn:MessageEventDefinition",
      type: "bpmn:StartEvent"
    }

so how to create element for message start event based on message event definition


#2

Hello Zen,

From my understanding,

What you can do is use ElementFactory

and createBpmnElement to model new element for you EventDefinition

Refer below code

var target = {
      eventDefinitionType: "bpmn:MessageEventDefinition",
      type: "bpmn:StartEvent"
    }
var newElement = elementFactory.createBpmnElement('shape', target);

#3

Thank you so much @Mrunal, this is what I am looking for. Working perfectly for me.