How to create a polyline with a default label when start at the gateway?


Hello everybody,

I need help for create a custon polyline when this is start at the gateway.

I saw that event is started in that part of code:

eventBus.on(‘connect.start’, function (event) {
var context = event.context,

                visual = svgCreate('polyline');
                svgAttr(visual, {
                    'stroke': '#333',
                    'strokeDasharray': [1],
                    'strokeWidth': 2,
                    'pointer-events': 'none'

                svgAppend(canvas.getDefaultLayer(), visual);

                context.visual = visual;

eventBus.on(‘connect.end’, function (event) {

                var context = event.context,
                    source = context.source,
                    sourcePosition = context.sourcePosition,
                    target =,
                    targetPosition = {
                        x: event.x,
                        y: event.y
                    canExecute = context.canExecute || canConnect(source, target);

                if (!canExecute) {
                    return false;

                var attrs = null,
                    hints = {
                        connectionStart: sourcePosition,
                        connectionEnd: targetPosition

                if (typeof canExecute === 'object') {
                    attrs = canExecute;

                modeling.connect(source, target, attrs, hints);

But, I don’t know discover when this event comes from the gateway and how can insert the label.


Please help us out by providing a mockup / sketch of the functionality you’d like to achieve.



For example, when the flow stay in gateway I need to pull the arrow with a default label “YES” and the other “NO”.


How do you distinguish which one to assign YES and NO to?

Generally speaking you could hook into the connection creation and assign a label to it:

:warning: Internal API here:

bpmnJS.on('commandStack.connection.create.preExecute', function(event) {
  var context = event.context;

  // TODO: read context, extract connection, set businessObject name
  // (if we detect the above pattern)

  // this will render the name post creation