How to Default a Value from an Event to Null/Blank if it Doesn't Work?

This topic was automatically generated from Slack. You can find the original thread here.

How can I default a value from an event to null/blank if it doesn’t work? I tried using: {{steps.trigger.event.testMode || ""}} but it still returns Cannot read properties of undefined (reading 'testMode'). The testMode value is not always in the event but when it is I want to use it in the next step.

Try {{steps?.trigger?.event?.testMode || ""}}

Thanks . I’m still getting the error. I think it’s because the key testMode exists in the event but has no value.

That error is usually when you try to read a key from an undefined object.

See Optional chaining (?.) - JavaScript | MDN

Yeah Marco is correct, this error means that steps.trigger.event does not exist. Where are you inputting the {{steps.trigger.event.testMode || ""}}?