How to copy and paste all the defined camunda properties from a bpmn diagram

I’m using the bpmn-js with the camunda moddle extensions but when I copy the userTask Task_03uibfp with the copy feature from bpmn-js, the camunda properties are not copied.

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
  xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
  id="Definitions_1"
  targetNamespace="http://bpmn.io/schema/bpmn">
  <bpmn:process id="Process_1" isExecutable="false">
    <bpmn:userTask xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Task_03uibfp" camunda:modelerTemplate="my.own.test">
      <bpmn:extensionElements/>
    </bpmn:userTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="UserTask_11ed4hk_di" bpmnElement="Task_03uibfp"><dc:Bounds x="185" y="177" width="100" height="80"/></bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

The camunda property “modelerTemplate” is lost when I paste it into a new userTask UserTask_1s4e3bo:

<bpmn:userTask xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Task_03uibfp" camunda:modelerTemplate="my.own.test">
     <bpmn:extensionElements />
</bpmn:userTask

The result diagram is:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
  <bpmn:process id="Process_1" isExecutable="false">
    <bpmn:userTask xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Task_03uibfp" camunda:modelerTemplate="my.own.test">
      <bpmn:extensionElements />
    </bpmn:userTask>
    <bpmn:userTask id="UserTask_1s4e3bo">
      <bpmn:extensionElements />
    </bpmn:userTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="UserTask_11ed4hk_di" bpmnElement="Task_03uibfp">
        <dc:Bounds x="185" y="177" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="UserTask_1s4e3bo_di" bpmnElement="UserTask_1s4e3bo">
        <dc:Bounds x="361" y="199" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Then the camunda properties are missing:

<bpmn:userTask id="UserTask_1s4e3bo">
    <bpmn:extensionElements />
 </bpmn:userTask>

The question is: What can I do to keep all the camunda properties when paste to a new userTask ?.

Did you properly integrate it as documented here?

The camundaExtensionModule is missing but the moddleExtensions is correct.

var camundaModdle = require('camunda-bpmn-moddle/resources/camunda');
var camundaExtensionModule = require('camunda-bpmn-moddle/lib');

var modeler = new BpmnJS({
    moddleExtensions: {
      camunda: camundaModdle
    },
    additionalModules: [
      camundaExtensionModule
    ]
  });

How can I do to generate a UMD bundle version of camunda-bpmn-moddle ? I’m still using the Bower package manager.

Is this correct to generate camunda-bpmn-moddle bundle with webpack this way ?

webpack lib/index.js --output-library camundaExtensionModule  --output bundled.js --mode=production

That should work!

You could consider migrating to our new pre-packaged distributions some day, maybe :slight_smile:.

I’ve already using the pre-packaged version. But the problem that I detect is:

The index.html must be updated continuously.
Why not update the version of the pre-packaged bundle without having to change the revision each time?

instead of “https://unpkg.com/bpmn-js@1.0.3/dist/bpmn-modeler.production.min.js”, why not:
https://unpkg.com/bpmn-js@1.0/dist/bpmn-modeler.production.min.js

It’s only a suggestion.

when 1.0 has the latest changes (1.0.x).

You may perform these changes yourself.

We prefer to be explicit which gives you the control as a user.

Many thanks for your help! I can clone now ALL the camunda properties without any problem.

But Is it normal to have the “oldBusinessObject” yet ?

53

Nope, this is not normal. Where did you spot the oldBusinessObject?

the oldBusinessObject appears when I paste it:

10

The new components has this attribute.