How to set camunda:formKey on UserTask Object

I am trying to achieve Dynamic Form Binding for that i need the camunda:formKey on bussinessObject

Lets say i have to attached Each task with different Dynamic Form

If i set on initial.bpmn for the StartEvent_1 Object i can able to bind Form Dynamically But how i can set for UserTask Object since there xml is dynamic generating

I also have tried this https://github.com/bpmn-io/bpmn-js-examples/tree/master/bpmn-properties

But not update XML

so, what i want is

<bpmn:userTask id=“Task_077xpif” name=“ApproveTask” camunda:formKey=“approveTask”>
bpmn:incomingSequenceFlow_1g078nz</bpmn:incoming>
bpmn:outgoingSequenceFlow_109q686</bpmn:outgoing>
</bpmn:userTask>

Dynamically

Are you using the Camunda BPMN model extension? Otherwise this property will be unknown and not be serialized.

can you please send one example where we can attached above property on userTask Object

1 Like

@vikashsingh009 How did you attempt to set the property? What did you try? Where did you get stuck?

Here is my finding code

var BpmnJS = require(‘bpmn-js/lib/Modeler’),
camundaExtensionModule = require(‘camunda-bpmn-moddle/lib’),
camundaModdle = require(‘camunda-bpmn-moddle/resources/camunda.json’);

var BpmnModdle = require('bpmn-moddle');
 additionalModules: [
   PropertiesPanelModule,
   camundaExtensionModule 
   ],
   moddleExtension: {
    //custom: customModdle,
    camunda: camundaModdle
  }
   var moddle = new BpmnModdle({ camunda: camundaModdle });

if (isAny(element, [‘bpmn:StartEvent’])) {
var formKey = moddle.create(‘camunda:formKey’, {
$body: ‘approveTask’
});
}

please help me on set camunda:formKey on startEvent Object