How to Create a new custom task in BPMN

Hi Team,

How to create a new Custom Activity/task in BPMN.IO. Basically a new custom task/Activity with a custom shape and can be persisted in the BPMN XML file.
For example, the start event is given out of the Box BPMN, the same way I want to create a custom/task and persist in BPMN.xml.

Thanks in advance.!

Hi @sandy8524,

did you already check out our custom elements example?

Hi @Niklas_Kiefer,

Yes, I know this example. It’s an example to extend any BPMN out of the box task/activity. I am looking for steps to create a custom task/activity in BPMN. Is it possible to do this?


This is exactly what the example is about? What are you missing?

Hi @philippfromme,

I am looking for a way to create a custom activity(not extending the out of the box activity).
My use case is.
1> The activity should be available in the tool palette and can be selected and dragged to the diagram to draw a flow.
2>The Custom activity added should be persisted in the Bpmn.xml when the download XML option is clicked.


What exactly do you mean by that?

As I said this is what the example is about?

Hi @philippfromme,

When i say " not extending the out of the box activity". comes with defined task(shapes with features) and all the examples are given how to extend those given. I need a way to create a task according to my custom need i.e custom look and feel and should be able to persist in BPMN xml file.

An example which is close to what I am looking for:

Basically the examples draw two new shapes and keep them in provider but what i am missing in the examples is how to persist these shapes in the BPMN XML file.

In the same example, the readme says **"This advanced example shows how to extend bpmn-js with new shapes and connections that are not part of the BPMN 2.0 diagram / incompatible with the BPMN 2.0 standard ".
What i understand from it, we can draw custom shapes but can’t be persisted in BPMN xml . Is my understanding correct ?

As the warning hint from upper part of the example said


Yes, this example does not show, how to persist your custom elements into the XML. Furthermore, this example is showing how to do that. Therefore it should be doable to combine both: a) creating a custom element b) persist your new custom element with a moddle extension.

Feel free to ask specific questions if you need help with that. Sharing your code inside a CodeSandbox would be really appreciated.