How to pass a custom json in subprocess in Camunda modeler

I am trying to pass a JSON to customJson target variable in a subprocess, the JSON would be something like {id: 1, name: ‘indil’}, how does that work ?

Another one would be to see how to build the JSON dynamically from the execution variables.

Was this post helpful? Save and retrieve JSON variable

That should at least cover the passing the variable as a JSON object.

Best Regards,
dg

I am assuming this is what you meant, when I tried this, I just see null when I am trying to access the variable inside the subprocess


Took a screenshot just before it was about to start the subprocess and the input Variable customJson is null

I believe that you have to map that variable out so that the following task will have access to it.

Best Regards,
dg

How do I map out the variable in the Modeler UI in that properties panel ? That was the question I had ?

Should it be done in a prior process and be passed into this subprocess ?

I got lazy and just put this in the XML:

<bpmn:callActivity id="sub-process-id" name="Sub Process Name" calledElement="subProcess">
      <bpmn:extensionElements>
        <camunda:in businessKey="#{execution.processBusinessKey}" />
        <camunda:in variables="all" />
        <camunda:out variables="all" />
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_0cgpsws</bpmn:incoming>
      <bpmn:outgoing>Flow_1f6207w</bpmn:outgoing>
    </bpmn:callActivity>

Which worked in passing all variables.