CustomElements: Autogenerate ID

Hello everybody,
What is the easiest way to automatically assign a random ID to custom-elements?

Hi @A.N,

Changing properties is possible using the modeling API:

modeling.updateProperties(myElement, {
  id: 'foo' // or a generated random id
});

You can also have a look on how the BpmnFactory is setting random ids for new elements.

Generate an ID on creation, i.e. using a running number.

Internally we use ids to come up with unique IDs that are slightly less likely to collision across documents.

1 Like