Setting an extension element node value

Hi guys, how do I programmatically set a node value (of an extension element) using moddle in javascript ? Lets say I have the following model extension:

  name: "myExtendableElements",
  prefix: "myElems",
  uri: "",
   xml: {
    tagAlias: 'lowerCase',
  associations: [],
  types: [
      name: 'MyExtendedElement',
      superClass: ['Element'],
      properties: [{ name: 'body', isAttr: false, type: 'String' }],

Now, creating the extended element and setting its value like

const extensionElements = moddle.create('bpmn:ExtensionElements');
 const newCustomField = moddle.create(`myElems:myExtendedElement`, {
          body: 'some-custom-value',
modeling.updateProperties(element, {
      extensionElements: extensionElements,

produces the following xml


while my desired output would be without the <myElems:body> tag, like


How do I achieve this, what did I do wrong?

Ah I think I figured it out, my body in properties should have an isBody: true flag, correct?

1 Like

That is correct (cf. bpmn-moddle, moddle-xml documentation).

In meta-modeling a property may be an attribute, body, or entirely virtual.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.