How to set Default values for Service Task property panels

I have created custom service task where i need to set default implementation type as “External” and topic name as “some topic name”

image

Here is my custom service code.

export default class CustomPalette {

constructor(create, elementFactory, palette, translate) {

this.create = create;

this.elementFactory = elementFactory;

this.translate = translate;

palette.registerProvider(this);

}

getPaletteEntries(element) {

const {

  create,

  elementFactory,

  translate

} = this;

function createServiceTask(event) {

  const shape = elementFactory.createShape({ type: 'bpmn:ServiceTask' });

  create.start(event, shape);

}

return {

  'create.service-task': {

    group: 'activity',

    className: 'bpmn-icon-service-task',

    title: translate('Create ServiceTask'),

    action: {

      dragstart: createServiceTask,

      click: createServiceTask

    }

  },

}

}

}

CustomPalette.$inject = [

‘create’,

‘elementFactory’,

‘palette’,

‘translate’

];

When creating the service task, you can directly define properties. The properties panel is designed to simply reflect the current XML state. So if you want to create an external service task with a predefined topic, you will have to do something like

function createServiceTask(event) {
  const shape = elementFactory.createShape({
    type: "bpmn:ServiceTask"
  });

  shape.businessObject["type"] = "external";
  shape.businessObject["topic"] = "foo";

  create.start(event, shape);
}

Source: custom palette provider (external service task) - CodeSandbox.

Note that you have to have the camunda-bpmn-moddle extensions included.

import CamundaModdlePackage from "camunda-bpmn-moddle/resources/camunda";

const modeler = new Modeler({
  // ...
  moddleExtensions: {
    camunda: CamundaModdlePackage
  }
});
1 Like

There are four things i want to achieve in camunda modeler.

  1. Need to remove element pallet and add my own elements pallet. i want to keep each elements as button.
    image

as mentioned in the image. i want to keep elements in button format

  1. Properties Panel- i want to keep only required fields in Properties Panel and want to remove tabs which is not required as mentioned in the below image

image

i want to keep only required fields in context menu. how to remove elements from context menu.

Thanks in advance

Inside the forum, there are various examples on how to remove certain elements from the palette (1), properties panel (2), context pad (3), e.g. for the context pad: How to remove Elements from ContextPad - #8 by Niklas_Kiefer

What did you already try to achieve that? How do your custom palette / properties panel / context pad providers look like?