Hi,
I have been trying to work this out for quite some time. I understand how to update properties on certain elements such as a sequence flow. like below:
case 'bpmn:SequenceFlow':
var moddle = modeler.get('moddle');
var newCondition = moddle.create('bpmn:FormalExpression', { body: '2>3'})
var modeling = modeler.get('modeling')
modeling.updateProperties(e.element, {'conditionExpression':newCondition} );
However I am trying to add a bpmn:timeDate entry to the following example XML.
<bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0ua9ccd">
<bpmn:timerEventDefinition />
</bpmn:intermediateCatchEvent>
so it looks like
<bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0ua9ccd">
<bpmn:timerEventDefinition>
<bpmn:timeDate xsi:type="bpmn:tFormalExpression">due_date</bpmn:timeDate>
</bpmn:timerEventDefinition>
</bpmn:intermediateCatchEvent>
What I thought I could do is get the timerEventDefinition and then call updateProperties like so
case 'bpmn:IntermediateCatchEvent':
var timerElement = e.element.businessObject.eventDefinitions[0]
var moddle = modeler.get('moddle');
var newCondition = moddle.create('bpmn:FormalExpression', { body: 'due_date' })
var modeling = modeler.get('modeling')
modeling.updateProperties(timerElement, {'timeDate':newCondition} );
The updateProperties is throwing a ‘typeError: businessObject is undefined’.
I am trying to do this when the user double clicks on the element so I cannot access the TimerEventDefinition Element directly.
Any help is very much appreciated.