How to set the value of the property panel programmatically?


#1

For example, get or set the ID. Will I do this?
O%24%5BCJ)SOR0%5B~%5BL0%25YXYI59N
I now need to set ID and Name. What should I do? Thank you!


#2

Hi @hyj,

if you want to change the properties of bpmn elements programmatically, you can do this by manipulating the xml. Check this to get an better understanding how bpmn.io handles XML imports.


#3

Changing properties is possible using the modeling API that is being used by the properties panel as well:

modeling.updateProperties(myElement, {
  id: 'foo',
  name: 'Foo'
});

This will result in a command being executed that can be reverted.


#4

Thanks, the problem has been solved


#5

Hi @hyj,

happy to hear! Can you post your solution? Would be great to share your successful approach with the community.


#7

OK, of course,Modify ID and name。

        let canvas = bpmnInstance.get('canvas ');
        let rootElement = canvas.getRootElement();
        var modeling = bpmnInstance.get('modeling');
        modeling.updateProperties(rootElement, {
          id: 'ABC',
          name: 'ABCD',
          isExecutable: true
        });