Updating Extension Elements: Best Practice?

I’m aware that I can use modeling.updateProperties() on base element attributes. I note that the modeling API suggests that this function is for “simple properties”.

What is the best practice for updating extension elements? I have created custom extension elements but I have not been successful updating their values. Do I simply have to step through the businessObject.extensionElements.values array, and then:

  • if the element exists: find the element by name ($type) and then update the element object
  • if the element does not exist, push a new object onto the values array?

Is this the best approach or does modeling.updateProperties() work for extension elements?

1 Like

The approach you’ve described is pretty much how it’s done in the bpmn-js-properties-panel. :slight_smile:

1 Like

This will not end in the command stack unfortunately no? ;(
Is there a way to update extension elements and push them onto command stack to enable undo redo?

First note: Please do not necrobump old topics. Instead link to this thread from new topic.

As far as the cmdHelper is used for updating the extension elements, the action will be push onto the command stack. Is there any scenario you see where it did not happened?

If you execute a command, it will end up on the command stack. How are you updating your properties?