Add and remove Element Is Not expected result

I have UserTask like this

<bpmn:userTask id="Activity_1j4nv8o" name="Task-2" camunda:assignee="${user}">
      <bpmn:incoming>Flow_01jebji</bpmn:incoming>
      <bpmn:outgoing>Flow_0dgq4vc</bpmn:outgoing>
    </bpmn:userTask>

It can be set to multiInstance or individual
I setting the multiInstance like this:

bpmnFactory.create(
‘bpmn:MultiInstanceLoopCharacteristics’,
{‘camunda:collection’:’${’+elementId+’_userList}’},
{‘camunda:elementVariable’:‘user’})
modeling.updateProperties(element,{‘loopCharacteristics’:multiInstanceLoopCharacteristics});

I found camunda:elementVariable=“user” is not be setting

<bpmn:userTask id="Activity_1j4nv8o" name="Task-2" camunda:assignee="${user}">
      <bpmn:incoming>Flow_01jebji</bpmn:incoming>
      <bpmn:outgoing>Flow_0dgq4vc</bpmn:outgoing>
      <bpmn:multiInstanceLoopCharacteristics camunda:collection="${Activity_1j4nv8o_userList}" />
    </bpmn:userTask>

and I use

modeling.removeElements([‘bpmn:MultiInstanceLoopCharacteristics’])

to remove bpmn:multiInstanceLoopCharacteristics but it 's not working.

Hi @Leo_Liu,

it’s hard to help you if we don’t know your exact use case and your setup. Is there a chance you can share it inside a CodeSandbox?

Make sure to include the Camunda model extension, otherwise you won’t be able to create Camunda-related elements.

import camundaModdlePackage from "camunda-bpmn-moddle/resources/camunda";
import camundaModdleExtension from "camunda-bpmn-moddle/lib";

const bpmnJS = new BpmnJS({
  container,
  keyboard: {
    bindTo: document
  },
  additionalModules: [camundaModdleExtension],
  moddleExtensions: {
    camunda: camundaModdlePackage
  }
});

CodeSandbox: Camunda Moddle Attribute Example - CodeSandbox