Exporting custom elements in the BPMN files

Hi everyone !

Continuing the discussion from Namespace not added to XML when exporting diagram with custom tags and How to add custom elements to the BPMN XML?:

As you can imagine reading the title of this topic, I managed to create some custom elements and added them them to modeler. I’m now wondering why they are not appearing in the *.bpmn file.

I created a custom meta-model specifically for my custom elements - here is the code:

  "name": "IDSM",
  "url": "http://some-company/schema/bpmn/cutomNs",
  "prefix": "idsm",
  "types": [
      "name": "risk",
      "properties": [
          "name": "name",
          "isAttr": true,
          "type": "String",
          "default": "risk"
      "name": "circle",
      "superClass": [

Quite simple isn’t it? :stuck_out_tongue_winking_eye:

Am I forced to use an external file as specified in the second quoted topic at the very top of this message? Or is it possible to allow custom elements to be saved in the conventional *.bpmn files?

Thank you for your answers. :slightly_smiling_face:

Does someone have an answer to this?

Custom elements can be saved to BPMN files in a valid way inside an elements extensionElements section:

    <startEvent id="StartEvent_1" name="hunger noticed">
        <custom:prop name="rolle" value="Chef" />
        <custom:prop name="label" value="Boss" />

The custom meta-model example goes into detail how to read, edit and write custom extensions.

Hope this helps.

Thank you, for your answer.

I just feel like the BPMN file given as an examples in the meta-model example act like a task contains the custom elements. Will it work if my custom elements act like separate elements (at the same level as a task)?

That won’t produce valid BPMN 2.0 XML files at least.

I tried to implement something that looks like the given example.

When one of my custom element is created I add it to the extensionElements of the root element with this code:

result = self.baseCreate(elementType, attrs);

parent = self._canvas.getRootElement();

parentBusinessObject = parent.businessObject;

parentBusinessObject.extensionElements = parentBusinessObject.extensionElements || self._moddle.create('bpmn:ExtensionElements');

But I’m getting this error when I try to save the BPMN file


Can you help me with this. I don’t really need something clean, I have to hand out this by Thursday… Thank you.

It is incredible hard to follow what you did and where you got stuck based on the partial code snippets you provide. In order for me or anyone else to help you (and in order for you to get along better), create a reproducible test case that captures your current implementation. Share it with us and we may be able to help you.

There is at least two ways to create such a test case / prototype:

  • Amend an existing starter project, hack in the relevant changes and share the result with us.
  • Create a new library or amend an existing example and add failing test cases that demonstrate the issues you’re experiencing.

Thanks :heart:

I have my work stored in a Github repository, you can find it here, my latest changes concerning the custom element saving are in the feature-objets branch and more precisely in this

I also have my custom meta-model here.

To use this I’m simple changing the import line in the camunda-modeler project just like this.

Hope it’ll help you.

How to reproduce your issue based on the project?

The process that leads to my issue is the following:

  1. Create a new BPMN diagram
  2. Add a new custom element to the diagram - It’s called risk it is a triangle in the palette
  3. Trying to save the diagram as a BPMN file or trying take a look at its content in the XML tab and the message I show early should appear in the console

Also, as you can see in the package.json file in the camunda-modeler/client project, my library is locally referenced.

Hi itisnalex have u got the solution for this

Please do not necrobump old topics. Instead link to this thread from new topic.