Read bpmn XML documentation attribute

Hi ,

Upon click i want to read the attribute of documentation attribute of shape. So far i can listen the click event and can read the ID and text of the shape but unable to read the documentation attribute as i am using panel extension while drawing the diagram.

Script for reading ID and text

eventBus.on(event, function(e) {
  //  e.element = the model element
  //  e.gfx = the graphical element
  e.element.id // Shap ID
  e.element.type // Shap type
  Title: '+ e.gfx.node.textContent // shape Name
}

how can read the documentation free text box element of panel extension?

XML is following

<bpmn2:task id="Task_09yhw7z" name="Check entitlement">
      <bpmn2:documentation><![CDATA[Check contract/order/warranty coverage/special conditions and when applicable perform credit check.
 
It is especially important to view customer special instructions for important customer specific information]]></bpmn2:documentation>

Hi @waqdev,

you can get access to an array containing all documentation objects for an element like this:

var documentation = element.businessObject.documentation;

You can then read the text of the first documentation element:

if (documentation) {
  documentation[0].text;
}
2 Likes

Many thanks!!! You are star!!!