Set property when creating element

Hi everyone,

I am currently trying to change the “Create expanded SubProcess”-Element to create an Event Sub Process instead. I have a custom Palette Provider and know that

  var subProcess = elementFactory.createShape({
    type: 'bpmn:SubProcess',
    x: 0,
    y: 0,
    isExpanded: true,
    options: { triggeredByEvent: "true" }
  });

creates

<bpmn2:subProcess id="Activity_0goo9p8">

How would I create this:

<bpmn2:subProcess id="Activity_04cjea9" triggeredByEvent="true">

I tried following this approach. overriding the update function of my custom palette. However, setting the property with domAttr(control, 'triggeredByEvent', true); seems to have no effect.

Edit: Just realized that this approach would only set properties in the palette, not in the elements created by it.

Found the solution: Simply call subProcess.businessObject.triggeredByEvent = true; on the created shape.

1 Like