Bpmn-js how to add condition expression to sequence flow

As I have understood, when using the bpmn-js modeler, the events contain elements that among other things, refer to an underlying businessObThis text will be hiddenject structure. Yet this isn’t intended to be interacted with directly, but through the modeler. Changing root properties works, but how about categories of properties? Specifically, in a ‘bpmn:SequenceFlow’ element, I would like to give it a ‘conditionExpression’ and set the ‘conditionExpression:body’ property programatically. How would I go about doing this?

This appears to fail due to conditionExpression being undefined:

var modeling = bpmnModeler.get('modeling');
bpmnModeler.on('selection.changed',e => {
    if (e.newSelection && e.newSelection.length === 1) {
        var element = e.newSelection[0];
        if (element.businessObject.$type === 'bpmn:SequenceFlow') {
            modeling.updateProperties(element, {
                'conditionExpression:type': 'bpmn:FormalExpression'

Preferably I would want to check what the source element is also, but that’s a different question

Can you share your setup in a CodeSandbox?. it will help us to help you better.

Maybe this thread also answers you’re question already.

There’s really not much more to it other than this, but I made a codesandbox anyway:

The only issue is I can’t set the conditionExpression:body property because there is no conditionExpression. With the properties panel, I can do it by setting the condition type under details. That is the procedure I am looking to replicate

Did you figure out how it works inside the Properties Panel (ConditionProps)? It should be doable to replicate that behavior.