Adding a custom bpmn type

Hi everyone,

I need to add a custom type, example- bpmn:myFunction to the bpmn modeler.
Have already gone through the custom elements example attached- https://github.com/bpmn-io/bpmn-js-examples/tree/master/custom-elements
but I am not looking for customizing an icon, or color but to define a custom bpmn type and add my business logic there.

I went through the code (bpmn-js, camunda-bpmn-moddle, etc) as to where the types are actually defined but couldn’t really identify it.

Thanks in advance.
Best Regards,
Pooja

Hi @PoojaPokharna, welcome!

Did you also check out this example? The most important thing is to adjust the underlying meta-model extension to add support for your custom element.

Basically, we always ensure that our modeling toolkits produce valid BPMN 2.0 XML, therefore adding extensions usually works via extension elements. Complete custom element types needs a bit of extra work. Can you explain a bit more, what your custom element should look like? In terms of business logic and use cases.

Thanks @Niklas_Kiefer for your response.
Let me have a look at the example and then revert.

Hi @Niklas_Kiefer,
Ok I now understand that defining a new type will potentially defy the rules. We should not do that.

Now, lets say I am trying to use the already existing type (bpmn:Task) and attach it to my custom function, maybe something like this in the bpmn-js\lib\features\palette\PaletteProvider.js -

‘create.my-function’: createAction(‘bpmn:Task’, ‘activity’, ‘bpmn-icon-my-task’, translate(‘My function’)),

While extending bpmn:Task works but I don’t know how to extend only ‘My function’ without affecting other bpmn:Task modules on the right properties panel using bpmn-js-properties-panel library?

Thanks in advance.

@Niklas_Kiefer We are still facing this issue. Do you have any suggestion?

Thanks for any help!

I think I don’t understand your use case enough to gather what you want to achieve. How is this custom “my function” business logic related to the properties panel? Palette and Properties Panel are completely different modules. If you want to have support for your custom element, you have to add such functionality properly in all of these modules.

Please explain your use case in detail so we can help you properly.

Hi Niklas,

Thank you for your response. I explored further and encountered “extensionElements”. I will dig further and try that out. Will keep you posted.

Thanks,
Pooja