Update modelling properties without triggering any event

Hi, there is a certain requirement in the project that i am working on, i need to update the modelling properties without triggering any event. Is there a way i can access all the elements without any trigger events?

Could you elaborate:

  • What do you want to update (specifically)?
  • Which events don’t you want to trigger?

Why?

I want to update the (name,value) of a particular element with type bpmn:SequenceFlow. So basically on click of bpmn:Task element, a modal appears and selecting a particular value in that modal updates the properties of that element, but i need to update the name,value of sequenceFlow element attached to it based on some checks.

What’s the issue with doing this the proper way (e.g. using Modeling#updateProperties)?

While using updateProperties, as we know that we need to pass element as the input, and in this case as we are not even clicking on that element but need to update it properties i am unable to do this, as i dont have that particular element.

Hi, any resolution on the same?

You can access the incoming and outgoing connections of a shape so that’s easy to implement.

modeler.get("eventBus").on("element.click", ({ element }) => {
  const { incoming = [], outgoing = [] } = element;

  [...incoming, ...outgoing].forEach((connection) => {
    modeler
      .get("modeling")
      .updateProperties(connection, { name: "foobar" }); // update all connection names
  });
});

Working example: Update connections on shape click example - CodeSandbox

Sure, it works. Thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.