Extend of Task/Subprocess with moddle not working

For some days I was trying to research and create a new element using moddle and add the button in the palette.

I started looking into the Model Extension (https://github.com/bpmn-io/bpmn-js-example-model-extension) but also having the idea to add the icon into the palette (following the example: https://github.com/bpmn-io/bpmn-js-example-custom-elements).

But my main problem is that I want to create a custom prefix ‘my:Task’ that inherit from Task (so, rendering the same and have the same properties), but I didn’t find any example that work well.

Also thinking about this, I went to the Camunda github, and if I want to add use this prefix into my bpmn app(github/camunda/camunda-bpmn-moddle/blob/master/resources/camunda.json) only adding the ‘moddleExtensions’ prop didn’t work.

Anyone can help me on this?


Can you maybe show a CodeSandbox which replicates your local setup? It will help us to understand better where your problem is.

You can have something like my:Task. That’s not valid BPMN. You can however extend tasks using the built-in extension machanism of BPMN. This is the right example for you: https://github.com/bpmn-io/bpmn-js-example-model-extension

Thanks Philip but I tried it, and not work (In my message I already left the same link)

I tried that example, but If I add a CustomPalette to add my new my:Task there is nothing to render.

I’ll try to update make an example.
But it’s very simple. I want a custom:Task (that inherit form bpmn:Task without have a customRender, and works) and add that custom:Task to the palette and have the ability to drag & drop my custom:Task.

Therefore it would be very appreciated if you could share your code.

Niklas: here a little example: https://codesandbox.io/s/affectionate-varahamihira-r25tf

I create a extenson of Task, I create a bpmn graphics using start, task, end and I replace the bpmt:Task for the test:MyTask that I create in the qaExtension

As I already pointed out, test:MyTask is not a valid BPMN element. This is not how you create custom elements.

This XML is not valid BPMN:

<test:MyTask id="Activity_1tcpidv">

You’d still create a bpmn:Task but could add extension elements to it to customize it. All of this is shown in the example.

Thanks Phillipp, Yes I understand that this library has a lot of problem of SOLID architecture.

Don’t worry I started to changed in my repository and now I have both working.
Thanks for your help.

What do you mean by that?