Connect modeler elements programmatically

Hello Camunda Team,
Is there a way to connect the task elements thru code without using the sequence /message flow action from the palette
I need only to connect bpmn:sequenceFlow elements in the bpmn xml without a visual connection (arrow shapes should be not be visible )

Any help is appreciated.

Kind regards,

you can create your BPMN with the Model API:

Is that the sort of thing you want to do?

Hey Stephen,
thank you for the quick response,

Check below my test case:
In the bpmn xml example In Progress and Approved are connected with the bpmn:sequenceFlow attributes:

  1. The attached Bpmn xml contains explicit connection between In Progress and Approved tasks below is the rendering in the diagram:

  2. The expected rendering in the diagram Bpmn xml will contain an implicit connection between In Progress and Approved tasks:

    <?xml version="1.0" encoding="UTF-8"?>
    <bpmn:definitions xmlns:bpmn="" xmlns:bpmndi="" xmlns:di="" xmlns:dc="" xmlns:xsi="" id="Definitions_1" targetNamespace="">
      <bpmn:process id="Process_1" isExecutable="false">
        <bpmn:startEvent id="StartEvent_1" name="Start">
        <bpmn:task id="Task_18d2r4l" name="In Progress">
        <bpmn:sequenceFlow id="SequenceFlow_0hft36n" sourceRef="StartEvent_1" targetRef="Task_18d2r4l" />
        <bpmn:endEvent id="EndEvent_0zyl0iw" name="End">
        <bpmn:sequenceFlow id="SequenceFlow_1jtudln" sourceRef="Task_18d2r4l" targetRef="EndEvent_0zyl0iw" />
        <bpmn:task id="Task_10qizfe" name="Approved">
        <bpmn:sequenceFlow id="SequenceFlow_0tddfhk" sourceRef="Task_18d2r4l" targetRef="Task_10qizfe" />
        <bpmn:sequenceFlow id="SequenceFlow_0zw5ha9" sourceRef="Task_10qizfe" targetRef="EndEvent_0zyl0iw" />
        <bpmn:sequenceFlow id="SequenceFlow_03ifuok" sourceRef="Task_10qizfe" targetRef="Task_18d2r4l" />
      <bpmndi:BPMNDiagram id="BPMNDiagram_1">
        <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
          <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
            <dc:Bounds x="173" y="102" width="36" height="36" />
          <bpmndi:BPMNShape id="Task_18d2r4l_di" bpmnElement="Task_18d2r4l">
            <dc:Bounds x="283" y="80" width="100" height="80" />
          <bpmndi:BPMNEdge id="SequenceFlow_0hft36n_di" bpmnElement="SequenceFlow_0hft36n">
            <di:waypoint xsi:type="dc:Point" x="209" y="120" />
            <di:waypoint xsi:type="dc:Point" x="283" y="120" />
              <dc:Bounds x="201" y="110" width="90" height="20" />
          <bpmndi:BPMNShape id="EndEvent_0zyl0iw_di" bpmnElement="EndEvent_0zyl0iw">
            <dc:Bounds x="569" y="102" width="36" height="36" />
              <dc:Bounds x="542" y="138" width="90" height="20" />
          <bpmndi:BPMNEdge id="SequenceFlow_1jtudln_di" bpmnElement="SequenceFlow_1jtudln">
            <di:waypoint xsi:type="dc:Point" x="383" y="120" />
            <di:waypoint xsi:type="dc:Point" x="569" y="120" />
              <dc:Bounds x="431" y="110" width="90" height="20" />
          <bpmndi:BPMNShape id="Task_10qizfe_di" bpmnElement="Task_10qizfe">
            <dc:Bounds x="282" y="203" width="100" height="80" />
          <bpmndi:BPMNEdge id="SequenceFlow_0zw5ha9_di" bpmnElement="SequenceFlow_0zw5ha9">
            <di:waypoint xsi:type="dc:Point" x="382" y="243" />
            <di:waypoint xsi:type="dc:Point" x="476" y="243" />
            <di:waypoint xsi:type="dc:Point" x="575" y="133" />
              <dc:Bounds x="431" y="168" width="90" height="20" />

Thank you again.Explicit connection.bpmn (4.5 KB)

Can you explain a bit more of your use case? Are you looking to build a State Machine?

These processes come to mind:

Iā€™m just looking how to connect task via javascript code without the arrow connection shapes:
In my case i have a generic task that will be dropped in the diagram then all other tasks will connect to it implictly without
using the sequence/Message fow action,
i would like to produce a bpmn xml files which contains a generic task which has connection to all other tasks
but the rendring in the diagram will hide this connection.



maybe your use case is covered by CMMN? You can start here for further reading:

Cheers, Ingo


@dhaker_gouissem if you are only looking to make a visual change but leave the xml the same, I would ask on:, and see what options they give you to extend/modify bpmn-js

1 Like

Hi @dhaker_gouissem,

is it only important for you to have DI part customized, or execution should be affected too?
It sounds to me like you are trying to do something conceptually really out of scope of bpmn. I think you should take a look at CMMN, as Ingo mentioned, with call activity integration in your process.


1 Like

Iā€™m still digging for a solution, I will check the CMMN project.
just a question is there a way to include a custom attribut called RankOrder = ā€œ1ā€ in the bpmn:task attributes which will be set programmatically,

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="" xmlns:bpmndi="" xmlns:di="" xmlns:dc="" xmlns:xsi="" id="Definitions_1" targetNamespace="">
  <bpmn:process id="Process_1" isExecutable="false">
    <bpmn:startEvent id="StartEvent_1" name="Open">
    <bpmn:task id="Task_0ne4plj" name="In Progress"   RankOrder = "1">
      </bpmn:task>  <bpmn:task id="Task_17yscmr" name="Approved" RankOrder = "2">

kind regards,


at the moment you cannot add attributes out of the box. You would have to extend

and couple of other projects to allow that.