Call some function when service task created (at drop of service task in canvas))

Hi All

I am looking for solution to call some function as soon as we drop service task on canvas.
Please suggest.
Thank you in advance.

You can use the create.end event for this

import { is } from 'bpmn-js/lib/util/ModelUtil';

eventBus.on('create.end', function (event) {
  const elements = event.elements;

  const createdServiceTasks = elements.filter(isServiceTask);


// helpers ////////////////

function isServiceTask(element) {
  return is(element, "bpmn:ServiceTask");
1 Like

Thank you @Niklas_Kiefer