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

@maxtru I’m working on an integration of GitHub - bpmn-io/bpmn-js-properties-panel: A properties panel for bpmn-js. into Drupal and the final piece is to implement the template selector. I have already successfully subscribed to the event and get the list of all available templates from the modeller. But I’m struggling to get access to ModelUtils with their helpful static functions and to the command stack for then applying the selected template. Can you probably give me some advice on that or link to some example code?

Hi @jurgenhaas ,

could you please create a new topic for this question, linking to this thread from the new topic.?