Updating name of Element - Error: Cannot convert undefined or null to object

Im trying to edit the name of a connection between two tasks. Other Shapes like Tasks can be updated but on setting the name of connections with

      modeler.get("modeling").updateProperties(someConn, {
        name: "abc"
      })

an error is thrown:

nhandled error in event listener TypeError: Cannot convert undefined or null to object
    at assign (<anonymous>)

    at assign (https://i5xgj0.csb.app/node_modules/min-dash/dist/index.esm.js:557:19)

    at eval (https://i5xgj0.csb.app/node_modules/bpmn-js/lib/features/modeling/behavior/LabelBehavior.js:90:31)

    at invokeFunction (https://i5xgj0.csb.app/node_modules/diagram-js/lib/core/EventBus.js:204:13)

    at EventBus._invokeListener (https://i5xgj0.csb.app/node_modules/diagram-js/lib/core/EventBus.js:130:19)

    at EventBus._invokeListeners (https://i5xgj0.csb.app/node_modules/diagram-js/lib/core/EventBus.js:119:24)

    at EventBus.fire (https://i5xgj0.csb.app/node_modules/diagram-js/lib/core/EventBus.js:94:24)

    at CommandStack._fire (https://i5xgj0.csb.app/node_modules/diagram-js/lib/command/CommandStack.js:138:29)

    at CommandStack._internalExecute (https://i5xgj0.csb.app/node_modules/diagram-js/lib/command/CommandStack.js:181:10)

    at CommandStack.execute (https://i5xgj0.csb.app/node_modules/diagram-js/lib/command/CommandStack.js:34:8)

    at Modeling.createLabel (https://i5xgj0.csb.app/node_modules/diagram-js/lib/features/modeling/Modeling.js:222:22)

    at UpdateLabelHandler.preExecute (https://i5xgj0.csb.app/node_modules/bpmn-js/lib/features/label-editing/cmd/UpdateLabelHandler.js:41:16)

    at CommandStack._internalExecute (https://i5xgj0.csb.app/node_modules/diagram-js/lib/command/CommandStack.js:168:15)

    at CommandStack.execute (https://i5xgj0.csb.app/node_modules/diagram-js/lib/command/CommandStack.js:34:8)

    at Modeling.updateLabel (https://i5xgj0.csb.app/node_modules/bpmn-js/lib/features/modeling/Modeling.js:51:22)

    at eval (https://i5xgj0.csb.app/node_modules/bpmn-js/lib/features/modeling/behavior/LabelBehavior.js:34:16)

    at invokeFunction (https://i5xgj0.csb.app/node_modules/diagram-js/lib/core/EventBus.js:204:13)

    at EventBus._invokeListener (https://i5xgj0.csb.app/node_modules/diagram-js/lib/core/EventBus.js:130:19)

    at EventBus._invokeListeners (https://i5xgj0.csb.app/node_modules/diagram-js/lib/core/EventBus.js:119:24)

    at EventBus.fire (https://i5xgj0.csb.app/node_modules/diagram-js/lib/core/EventBus.js:94:24)

    at CommandStack._fire (https://i5xgj0.csb.app/node_modules/diagram-js/lib/command/CommandStack.js:138:29)

    at CommandStack._internalExecute (https://i5xgj0.csb.app/node_modules/diagram-js/lib/command/CommandStack.js:181:10)

    at CommandStack.execute (https://i5xgj0.csb.app/node_modules/diagram-js/lib/command/CommandStack.js:34:8)

    at Modeling.updateProperties (https://i5xgj0.csb.app/node_modules/bpmn-js/lib/features/modeling/Modeling.js:76:22)

    at eval (https://i5xgj0.csb.app/src/index.js:33:39)

Im using the Pizza collaboration example.
here a codesanbox

Is there a reason in the diagram why i cant set names on connections?

The name isn’t a property of the shape itself, therefore your approach doesn’t work.

You can use modeling.updateLabel(shape, 'foobar') for that purpose.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.