How can I check if all elements in BPMN diagram is labelled or not?

I need to do some kind of validation on the bpmn diagram like checking every element in the diagram if they are labelled or not. Is there a way to do it by default or please suggest a method to achieve it.


You might want to do something like this:

var labelUtil = require('bpmn-js/lib/features/label-editing/LabelUtil'); 

var elements = elementRegistry.filter(function(element) { 
  if (!labelUtil.getLabel(element)) { 
    return false; 
  return true; 

if (elements.length > 0) {
  // do something with non-labeled elements...

This bpmn-js interaction example could be relevant as well.

Hope this answers the question.


1 Like