Add default text to bpmn element when dragging it into the diagram


Hi Team,

I would like to add default text in bpmn element when dragging it into the diagram?
please any hints to do that.

Thanks and best Regards,


what is the use case? Do all/most of your elements have the same prefix? Normally the bpmn-text is individual on a high degree


I need when dragging an element will take default name after dragging it into the diagram.


I did something similar: I added some default variable value to an element when it was created.

This module should do the trick:

const BpmnElementFactory = require('bpmn-js/lib/features/modeling/ElementFactory');
const inherits = require('inherits');
const ModelUtil = require('bpmn-js/lib/util/ModelUtil');
const getBusinessObject = ModelUtil.getBusinessObject;
const is =;

function ElementFactory(bpmnFactory, moddle, translate) {, bpmnFactory, moddle, translate);

inherits(ElementFactory, BpmnElementFactory);

ElementFactory.$inject = [

module.exports = ElementFactory;

// Hook into creation process
ElementFactory.prototype.create = function(elementType, attrs) {
    let element =, elementType, attrs);

    // Only set the name if the element is a task, subprocess or call activity
    if (is(element, 'bpmn:Activity')) {
        getBusinessObject(element).set('bpmn:name', 'This is default text');

    return element;

This module must be passend in an object as additional module to the modeler on start-up:

    __init__: [ 'elementFactory', ],
    elementFactory: [ 'type', require(/* PATH TO FILE */), ],