Adding properties

Hi everyone,

I’ve followed the example of bpmn-properties and it works fine, but how can I do the same for a property with multiple values like DataInput? I’ve tried this:

var ioSpec = this.model.create("bpmn:InputOutputSpecification", {inputSets: []});

this.modeling.updateProperties(diagramElement, {ioSpecification: ioSpec});

This creates the InputOutputSpecification correctly and creates an empty array. Now I want to add an InputSet to that array, can I do that using the updateProperties function?

var input = this.model.create("bpmn:InputSet", {name: "input"});
this.modeling.updateProperties(???);

You cannot do that via Modeling#updateProperties. You need to write your own command handler. See UpdateBusinessObjectHandler from the bpmn-js-properties-panel project.

I managed to do it at the end.

I read the container(ioSpecification) to a local variable, then I add InputSets to that variable, and I just update the ioSpecification property with update.

var bo = diagramElement.businessObject;
var ioSpec;
if (bo.ioSpecification !== undefined) {
    ioSpec = bo.ioSpecification;
    ioSpec.inputSets.push(myInputSet);
}
 ...
 this.modeling.updateProperties(diagramElement, {ioSpecification: ioSpec});