Update task label from outside

Hi,
I am using this to create a workflow (json) using react. Double tap on task some pop up will appear and need to update some properties for the json. I can change label of json also from there. But it is not visible in the diagram. Actually I need to update label from outside of diagram. How can I do that

Hi @aswinpj_edy ,

I am using this to create a workflow (json) using react.

What are you refering to with this?

Can you please be more specific? What exactly is not working? Can you please share the code or a code snippet showcasing the problem?

In general I would recommend to take a look at the modeling via API example, which gives a good overview of how to interact with a diagram on API level.

Regards
Max

I mean using bpmn-js I can draw some designs. I am storing path attributes and using an emptyBpmn I am reconstruct the the design. what I need is, want to change the label of task from outside. It is possible to change the label when double tap, But I need it from outside the diagram.Screenshot from 2021-07-02 14-43-44

I am not sure what you mean with outside. However you could:

Do the change via API
For example:

  // (1) Get the modules
  const elementRegistry = modeler.get('elementRegistry'),
        modeling = modeler.get('modeling');

  // (2) Get the shape
  const startEvent = elementRegistry.get('StartEvent_1');

  // (3) Change the start event's `name` property using `updateProperties`
  modeling.updateProperties(startEvent, { name: 'Foo' });

Just change the label in the XML
Notice this would of course only work in case you import the diagram afterwards (as said, I don’t know what you mean with outside).