Unlink/Remove function in element templates

As per the element templates documentation,

  • Remove: Remove the element template from the camunda:modelerTemplate property and also reset all properties of the respective element.
  • Unlink: Remove the element template from the camunda:modelerTemplate property but keep the properties which were set.

As I understand, the camunda:modelerTemplate property is added by default but this can be removed using the Unlink function. So for what is the camunda:modelerTemplate property used? How does it affect the diagram?

The camunda:modelerTemplate property is for linking the BPMN 2.0 element to the actual element template JSON across the whole lifecycle when working with element templates. This means to handle applying all the properties coming from the JSON, reacting on updates and version changes.

Once you unlink it, as you already discovered, this camunda:modelerTemplate gets removed and the linkage is gone. The applied properties are still there, but there won’t be any updates anymore once the template changed.

If you completely remove the template, all the applied properties will also get removed.

Thanks @Niklas_Kiefer for your response!

Assume we create a diagram with a template and save it. When we load this XML again, if the camunda:modelerTemplate property is present, the diagram will load properly with the associated template. But if the property is not present, the template will not load properly. Is this understanding correct?

Assume we create a diagram with a template and save it.

What do you mean by that? The diagram and the template are different files here. You can only link a diagram to a template via the property.

And yes, if the property is not set or the template is not present, it can’t load properly and the properties panel will show what the BPMN 2.0 XML reveals.

What I meant was saving the diagram XML file. And when we open the diagram file, if the property is not present the template will not get loaded.

So as I understand, it’s necessary to keep the camunda:modelerTemplate property. Is there a way we can hide the “Unlink” option, so that the user doesn’t remove this property?