How to update element-id of shapes and connectors?


#1

Hi,
I want to update the id of shape and connectors, How can i do this?

EG:
I want to update the below higlhlighted ID

 <bpmn:startEvent **id="StartEvent_07eipeb"**>
      <bpmn:outgoing>SequenceFlow_0vkap0n</bpmn:outgoing>
    </bpmn:startEvent>

#2

https://github.com/bpmn-io/diagram-js/blob/master/lib/core/ElementRegistry.js#L71 :wine_glass:


#3

Here I’m trying to update the BPMN ShapeID (hightlighted below ),
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement=“StartEvent_1”>

//code which i written
this.bpmnJS = new BpmnJS();
this.bpmnJS.get(‘eventBus’).on(‘shape.move.end’, (event) => {
const elementshapeID = event.shape.businessObject.di.id;
const modeling = this.bpmnJS.get(‘modeling’);
modeling.updateProperties(event.shape.businessObject.di.id, "myCustomeID_2’);

I would like to know how to update the BPMNShape id

Thanks in advance


#4
modeling.updateProperties(myElement, {
  di: {
    id: 'foo'
  }
});

There you go.