Adding an Element Template to existing bpmn-js Instance

Continuing the discussion from Dynamic element templates in bpmn-js:

So: After the instantiation of the modeller BpmnJSModeler( ... ), i’d like to add more elementTemplates to the existing ones. Rather than having to reload the whole bpmnJSModeler instance.

I’d love to find a way to achieve this! But so far I found nothing in the docs or in any related example…
Maybe there is a way or someone tried something in those directions or can point me towards some meaningful doc entries :slight_smile:
Any help is greatly appriciated!

I think you won’t find any docs for this.

There is an API around to add and reload templates.

What did you already tried to achieve what you want? Can you give maybe some more details about what you want to achieve at all? Sharing your code in a CodeSandbox would be very appreciated.

1 Like

Wow that’s already amazing!
I think I got it kinda working so far. (Deep down some customization stuff, so sadly not an easy Sandbox / MWE … )
Working means: the eventbus elementTemplates.changed gets triggered correctly … anyhow, I’m using the bpmn-js-properties-panel for some sort of dealing with the templates, but here the update doesn’t seem to show up. Is there a way for me to “force” the properties-panel to reload the templates as well?
Thanks so far!


I got it working, while trying to build a CodeSandbox to further explain my issue…
For anyone finding this: Here is my dumb Sandbox.
My main error / misconception was that I mustn’t use the elementTemplateLoader.reload() function after setting the templates with elementTemplateLoader.setTempalte(templates) function.
Again: Thanks so much for pointing me to the API! That was the info I needed!

Thanks for sharing your solution! :+1: