How to set a Map as Value for InputParameter using BPMN Moddle

Hi Phillip,

That worked, I appreciate your help.

Thank you again,
Daniel S.

You create an input parameter with a map as follows:

const entry = moddle.create("camunda:Entry", { key: "foo", value: "bar" });

const map = moddle.create("camunda:Map", { entries: [entry] });

entry.$parent = map;

const inputParameter = moddle.create("camunda:InputParameter", {
  definition: map
});

map.$parent = inputParameter;

Full example: Camunda Map Example - CodeSandbox

1 Like

I do have a follow up question, though.

Your solution works great. How can I access the entry’s value by key on my backend?

I’m using Java/Kotlin:

    import org.camunda.bpm.engine.externaltask.LockedExternalTask

    //... irrelevant code

    val nodeInput = lockedExternalTask.variables.getValue(RunJobConstants.NODE_INPUT) as String
   

I was doing this to get my value from a string, but now, that string is wrapped in a map and an entry.

By the way, where can I find the API reference or somewhere I can check this on my own? I’m having a hard time locating stuff.

Thanks for your help.

It looks like your question is not related to our project or one of our toolkits. For questions regarding other tools please refer to their respective communication channels. If your question is about the Camunda platform or the Camunda Modeler, please head over to the Camunda forum for assistance.

Please provide more context if you are certain this is the right place to get an answer and we may be able to help you.

Thank you :sunny:

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