Custom meta-model ignored

Hi everyone,

As I created a custom element for my custom modeler, I created a meta-model to define properties for element. But, as I’m trying to include the meta-model in the modeler, it simply gets ignored.

Here’s my meta-model and here’s the piece of code where I include the meta-model in the modeler as explained in the custom meta-model example:

moddleExtensions: {
      camunda: camundaModdlePackage,
      idsm: idsmModdlePackage,
},

When I create a new BPMN diagram, I’m getting this:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions 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_0ttbn0s" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.15.0-dev">
  <bpmn:process id="Process_1" isExecutable="true">
    <bpmn:startEvent id="StartEvent_1" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="173" y="102" width="36" height="36" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

And as you can see, I don’t have the URI of my meta-model. Is this normal? And how can I fix this?

I made a quick test. I use a custom model myself and it doesn’t get added to the xml namespaces until I include at least one of my custom elements in the model.

So everything seems normal behaviour.

Thank you for your answer, but I still have a question.

What do you when you say « until I include at least one of my custom elements in the model » ? Does it mean including the custom elements through the GUI modeler or including them programmatically?

Would you mind sharing a piece of code where you bind the meta-model to the custom elements? The ElementFactory for instance.

My guess is both.

var bpmnDiagram = new BpmnJS({
            container: container,
            moddleExtensions : {
                camunda         : JSON.parse(camundaModel),
                onCustomer	: JSON.parse(onCustomerModel)
            },
            additionalModules: [ additionalModules ]
        });

This is my binding, my json is like yours all my custom elements are extensions of standard elements, for example:

{
			"name": "OnCustomerSlaAssignmentTask",
			"extends": [
				"bpmn:ServiceTask"
			],
			"properties": [
				{
					"name": "slaTemplate",
					"type": "String",
					"isAttr": true
				}
			]
		},

I make modifications by calling
modeling.updateProperties(someServiceTaskInTheModel, {slaTemplate: 'mySlaTemplateId'});

I attach delegates later to perform my special SlaAssignmentTask in the camunda engine.

Edit:
Can you explain what are you trying to achieve with that risk element you defined? Maybe I can help you better if I understand the goal.