How to use bpmn-moddle to create camunda:Map?

Viewed 20

I'm using BpmnModdle on my React Client and I want to set a Map with one Entry as value for my InputParameter but I can't find the correct way of doing it.

This is roughly what I have:

    const moddle = new BpmnModdle({ camunda: camundaModel });
    //a bunch of irrelevant code
      const inputParameter = moddle.create('camunda:InputParameter', {
         name: 'input',
         value: configuration,
      });

As you can see, my InputParameter has its value assigned to a configuration variable, which is a String.

But now, I would like my InputParameter to look like this:

<camunda:inputParameter name="Input_1reuurk">
  <camunda:map>
    <camunda:entry key="key">"String value that is too long" </camunda:entry>
  </camunda:map>
</camunda:inputParameter>

I'm now trying the following but it fails on validation:

//Try to create an Entry, and set configuration (a string) as its value
  const testEntry = moddle.create('camunda:Entry', {
    key: "entry",
    value: configuration
  });

//Now create a map and set the entry I created above as value
  const testMap = moddle.create('camunda:Map', {
    value: testEntry
  });

//Finally add the map to my InputParameter as value
  const inputParameter = moddle.create('camunda:InputParameter', {
    name: 'input',
    value: testMap,
  });

Can anyone please point me to documentation or an example of how to properly go through this process?

Thank you!

0 Answers
Related