Set process variable to elements

Hi
I am using BPMNJS library in Angular and I want to set process variables of input/output from my modal inputs how can we set the process variables / how to get the instance of the input/output of the current element
Thanks

Inside the bpmn-js-properties-panel we have helpers for fiddling around with Camunda input/outputs (I assume that’s what you’re talking about). Maybe this can be an inspiration for you.

Otherwise, please provide more details so we can help you in a deeplier manner.

1 Like

The properties panel is built in a way that it displays what it gets from the BPMN 2.0 XML, e.g. all existing input parameters for an element.

Can you give an example of what the XML should look like after you select a value from this Modal? The goals should be to update the element accordingly via the existing API. That’s basically what the properties panel is also doing with the helper I posted above.

A valid input parameter would e.g.

<bpmn:task id="Activity_1hsdm9e">
  <bpmn:extensionElements>
    <camunda:inputOutput>
      <camunda:inputParameter name="Input_0e4jqs0">value</camunda:inputParameter>
    </camunda:inputOutput>
  </bpmn:extensionElements>
</bpmn:task>
1 Like

Hi Niklas_Kiefer
Thanks for the update.
I want to set value in the same way how u showed in XML. I just want to bind my modalwindow value to this inputparameter value before SaveXML.
<camunda:inputParameter name=“Input_0e4jqs0”>MymodalInputvalue</camunda:inputParameter>
so I need this Object to set the value.how to get this camunda:inputoutput object from modeler in ts/js.

As I said above, we use helpers to get this information from an element. Once you get the element (e.g. via elementRegistry) you can get this information.

const elementRegistry = modeler.get('elementRegistry');

const element = elementRegistry.get('StartEvent_1');

const inputOutput = InputOutputHelper.getInputOutput(element);
1 Like

Hi Niklas_kiefer
Thank you soo much for the update. I will try this

1 Like

Thanks Niklas_kiefer it worked for me.

Hello @shweta I’m stuck in creating custom input and output parameters. I’m also expecting same XML that you created. Can you share your demo code with me?