Updating attributes in nested tags from an example


I am looking into updating extension attributes and elements following GitHub - bpmn-io/bpmn-js-example-model-extension: An example of creating a model extension for bpmn-js.

In the given example, the below part demonstrates how to set the value to attribute

const suitabilityScoreEl = document.getElementById('suitability-score');

const suitabilityScore = Number(suitabilityScoreEl.value);

if (isNaN(suitabilityScore)) {

const extensionElements = businessObject.extensionElements || moddle.create('bpmn:ExtensionElements');

let analysisDetails = getExtensionElement(businessObject, 'qa:AnalysisDetails');

if (!analysisDetails) {
  analysisDetails = moddle.create('qa:AnalysisDetails');


analysisDetails.lastChecked = new Date().toISOString();

const modeling = bpmnModeler.get('modeling');

modeling.updateProperties(element, {
  suitable: suitabilityScore


I understand how to update the attributes lastChecked or nextCheck.

But I am not sure how would I update qa:comment? Suppose if I want to change the text body of qa:comment, how would I do that?

Any help would be appreciated. Thanks!

You can look into bpmn-js-example-model-extension/qa.json at master · bpmn-io/bpmn-js-example-model-extension · GitHub to see the structure defined by the model extension.

const extensionElements = businessObject.get('extensionElements')?.get('values');

if (extensionElements) {
  const analysisDetails = extensionElements.find(extensionElement => {
    return is(extensionElement, 'qa:AnalysisDetails');

  if (analysisDetails) {
    const comments = analysisDefails.get('qa:comments');

    comments.forEach(comment => comment.set('text', 'Foo'));

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