Developer FAQ (bpmn-js)


#1

This is a collection of frequently asked questions and their solutions.

How do I access BPMN specific attributes behind a diagram element?

Access the BPMN object behind a diagram element via el.businessObject. This gives you the BPMN element that will later be serialized to BPMN 2.0 XML.

If you have, lets say a shape, Task_1 you can do stuff like:

var taskShape = elementRegistry.get('Task_1'),
    task = tashShape.businessObject;
    
var loopCharacteristics = task.loopCharacteristics;
    
// loop characteristics tell you whether or not 
// MI / Paralell / Loop is being set.

You can learn about all available properties in the BPMN 2.0 Spec or the bpmn.json moddle descriptor we provided for it (quote).

How do I update BPMN attributes of a diagram element?

Use modeling.updateProperties(element, { ... }). See more details on updating element attributes or updating an elements id.

If you would like to update the name of a diagram element, i.e. a start event:

var startEventShape = elementRegistry.get('StartEvent_1');
modeling.updateProperties(startEventShape, {
  name: 'New name'
});

How do I learn about BPMN specific properties?

Checkout the bpmn.json descriptor. It is a JSON version of the offical BPMN 2.0 meta-model and contains all valid BPMN types and their properties.

Watch build fails with ENOSPC on Linux

> grunt auto-build
Running "browserify:watch" (browserify) task
Warning: watch ....
ENOSPC Use --force to continue.
Aborted due to warnings.

You must increase the amount of file watchers on your system. See this Stackoverflow thread.

Not all BPMN elements are implemented!

All BPMN 2.0 elements are available via the wrench symbol in an elements context pad:


How to use bpmnjs on java web application?
How to force a refresh on the diagram?
#2

Hello nikku,

does the accessing advance change with the coming update?

Greetings
Matthias


#3

Nope. Tell us if you find any inconsistencies though!