Hello,
I’m adding a custom property to the properties panel, and I’d like to have the name of each element update to match my custom property when its set method is called. My code works for task elements, but not intermediate events. The labels for intermediate events don’t update unless I refresh the page. I’ve seen answers to similar questions refer to Modeling.updateProperties(), but I don’t know how to get a reference to the modeling object in the context of the set method. Also, my code seems to do something very similar: the command object that gets returned gets passed to the command stack just like Modeling.updateProperties(). Am I missing something?
import entryFactory from 'bpmn-js-properties-panel/lib/factory/EntryFactory';
import cmdHelper from 'bpmn-js-properties-panel/lib/helper/CmdHelper';
export default function(group, element, customOptions) {
element.options = customOptions;
group.entries.push(entryFactory.selectBox({
id: 'WorkflowObject',
label: 'Workflow Object',
dataValueLabel: 'workflowLabel',
selectOptions: getOptions,
modelProperty: 'workflowObject',
emptyParameter: false,
setControlValue: true,
get: function(element, node) {
var o = findSimpleObject(element, node);
if(o){
return {'workflowObject' : o.id, 'workflowLabel': o.name};
}
return {'workflowObject' : '', 'workflowLabel': ''};
},
set: function(element, values, node) {
var bo = getBusinessObject(element);
var so = findSimpleObject(element, node, values.workflowObject || '');
var boProperties = {};
bo.workflowObject = values.workflowObject;
var commands = [];
if(so){
bo.name = so.name;
boProperties['name'] = so.name;
boProperties['workflowObject'] = values.workflowObject || '';
commands.push(cmdHelper.updateBusinessObject(element, bo, boProperties));
}
return commands;
}
}));
}
Thanks,
John