Editing documentation using plugin

Hi,
Is it possible to edit documentation of an element in a plugin? Properties like name or id can be modified using modeling.updateProperties, however it’s not gonna work for documentation since it’s in another xml tag.

You can do that via modeling.updateProperties, this way

const modeling = modeler.get("modeling");
const elementRegistry = modeler.get("elementRegistry");
const bpmnFactory = modeler.get("bpmnFactory");

const shape = elementRegistry.get("StartEvent_1");

const documentation = bpmnFactory.create("bpmn:Documentation", {
  text: "foo"
});

modeling.updateProperties(shape, {
  documentation: [ documentation ]
});

Source: update documentation - CodeSandbox

1 Like