How to set formKey like "Camunda:formKey" for particular userTask

hi,
actualy i’m getting Formkey for UserTask from the user through modal(i’m not using properties-panel).and i need to set formkey for that perticular userTask

so, what i want is
<bpmn:userTask id=“Task_877xpif” name=“ApproveTask” camunda:formKey=“userFormKey”>
bpmn:incomingSequenceFlow_1g078nz</bpmn:incoming>
bpmn:outgoingSequenceFlow_109q686</bpmn:outgoing>
</bpmn:userTask>

please help me on set camunda:formKey for specific userTask.

Grab the element and update the formKey property. Make sure, you have loaded the Camunda model extension.

const userTask = elementRegistry.get("Activity_1");

modeling.updateProperties(userTask, {
  formKey: "foo"
});

Full example: https://codesandbox.io/s/set-camundaformkey-example-i461v

1 Like

thank you. @philippfromme it’s working perfect