Retain the ID with one element id when replaced by new element

How can I retain ID of old element to new element once it is replaced.
example:
I have bpmn:Task with ID = Task_18at0zg in my diagram.
I have replace it with bpmn:SubProcess with ID = SubProcess_1qaoe4i.
I want ID to be remain same.
Can anyone help me with this.
Thanks in advance.

Principally you can always set the ID in the properties panel. So at the moment you would need to explicitly do this.

However, I vote to see this as a feature request I’d strongly support: preserve the “technical” IDs of elements when replacing them with similar elements by using the wrench tool.

Variant 1: just always preserve the “technical ID”
Variant 2: just preserve a technical ID which does not follow the default pattern for IDs anymore

More background: for executable flows, it is a good practice to change such IDs to developer friendly IDs with a more business relevant meaning. After all these IDs show up in the database as well as in the logs. If e.g. an exclusive gateway changes to to inclusive one or a none end event changes to a message end event, we will therefore typically want to preserve the IDs. If not, we can always change them to something else explicitly.

We have an existing ticket for that.

1 Like