Default Templates for same BPMN type

I have two custom palette elements of type ‘bpmn:ServiceTask’. Is it possible to set a default template to one of these pallete elements and another default template to the other element? Can there be mutiple template descriptor files?

Hi @Sangeeth_VS,

this is not possible out of the box, but would be doable by building a bpmn-js plugin, if that would be an option for you?

With a plugin you could:

  1. Create two new custom palette entries
  2. Once one of these palette entries is clicked, perform something like:
    const shape = elementFactory.createShape({ type });

    commandStack.execute('propertiesPanel.camunda.changeTemplate', {
      element: shape,
      newTemplate: template

The templates available can be retrieved by injecting the elementTemplates service and doing something like this:

    const allElementTemplates = elementTemplates.getAll('*');

    // only use element templates, which have one dedicated shapeType
    this._elementTemplates = allElementTemplates.filter(
      template => template.appliesTo.length === 1 && !UNSUPPORTED_TYPES.includes(template.appliesTo[0]));

A plugin doing something similar can be found here: GitHub - MaxTru/camunda-modeler-templates-from-palette-plugin