When I make conditional intermediate catch event element, a condtion expression should be set. But I can’t find which method can be set the expression value? Could someone make any suggestions? Thanks
The expression props is below:
const getValue = () => {
const businessObject = getBusinessObject(element);
var condition = businessObject.conditionExpression;
if (condition)
return condition.body;
else
return '';
}
const setValue = value => {
const businessObject = getBusinessObject(element);
const conditionObject = businessObject.eventDefinitions[0];
var expression = conditionObject.condition;
expression.text = value;
return modeling.updateProperties(element, {
conditionExpression: expression
});
}
The xml content is below:
<bpmn2:intermediateCatchEvent id="Event_1com9as" sf:guid="060168fc-14b9-47ca-c187-6d05239ac082" element="[object Object]">
<bpmn2:incoming>Flow_1ui3mz5</bpmn2:incoming>
<bpmn2:outgoing>Flow_0z4t3bc</bpmn2:outgoing>
<bpmn2:conditionalEventDefinition id="ConditionalEventDefinition_1y79d9l">
<bpmn2:condition xsi:type="bpmn2:tFormalExpression" />
</bpmn2:conditionalEventDefinition>
</bpmn2:intermediateCatchEvent>
The condition node in xml should be updated with the expression value, but it seems that I made the wrong usage of the modeling.updateProperties() method or its arguments. The error information is below.
unhandled error in event listener TypeError: businessObject.sourceRef is undefined
ReplaceConnectionBehavior ReplaceConnectionBehavior.js:171
invokeFunction EventBus.js:519
_invokeListener EventBus.js:371
_invokeListeners EventBus.js:352
fire EventBus.js:313
_fire CommandStack.js:356
_internalExecute CommandStack.js:431
execute CommandStack.js:153
updateProperties Modeling.js:98
setValue ExpressionProps.js:44
handleChange index.esm.js:1499
node_modules index.js:2920
fire index.esm.js:413
setTimeout handler*schedule index.esm.js:418
fire index.esm.js:410
setTimeout handler*schedule index.esm.js:418
fire index.esm.js:410
setTimeout handler*schedule index.esm.js:418
callback index.esm.js:448