Modifying attributes on diagram elements (e.g. name)

Your code will update the displayed name perfectly fine. It will just not update the right element because the name changed on the events label. Access an elements label (if it exists) via e.element.label.

You can have a look into Modeling#updateProperties, too. It properly updates properties of an element and makes sure the changes properly end up in diagram + XML:

var startEventShape = elementRegistry.get('some-id');
modeling.updateProperties(startEventShape, {
  name: 'New name'
});

Whenever you would like changes to be undoable (and to end up in the BPMN 2.0 XML) they have to be carried out via the modeling service anyway.

What are you guys building by the way? Any chance we can feature it?

3 Likes