#PowerPlatformTip 59: 'Handle Dynamic Content'
TL;DR: Add the safe navigation operator
?(e.g.item()?['id']) so missing properties return null instead of crashing your flow.
💡 Challenge
When working with Power Automate and dealing with objects or arrays, you often come across expressions like item()['id']. But what if id is not always present in each item? A missing property makes your flow throw an error and fail.
✅ Solution
Use the safe navigation operator ?, for example item()?['id']. It ensures that even if id is missing in some items, your flow won’t crash. Instead of an error, it returns null, which is a lifesaver when your data isn’t always consistent.
🔧 How It’s Done
1. Spot the risky reference
🔸 Find expressions such as item()['id'], body('Action')['value'] or triggerBody()['field'] that assume a property always exists.
2. Add the safe navigation operator
🔸 Insert ? before the bracket: item()?['id'].
🔸 The expression now returns null instead of failing when the property is missing.
3. Handle the null case
🔸 Use coalesce(item()?['id'], 'default') or a Condition to react to missing values gracefully.
Real flow run: outputs('Sample_Object')['email'] fails outright, “property ‘email’ doesn’t exist, available properties are ‘id, name’”, while outputs('Sample_Object')?['email'] on the identical object succeeds right next to it.
Real flow run: the ?['email'] version shows Status Erfolgreich with an empty output, null, not an error, exactly the graceful fallback the operator is for.
🎉 Result
Your flows keep running even when incoming data is inconsistent, returning null instead of throwing errors, far more robust and easier to maintain.
🌟 Key Advantages
🔸 Prevents runtime errors from missing properties
🔸 Returns a predictable null you can handle explicitly
🔸 Minimal effort, just one character per reference
🎥 Video Tutorial
🛠️ FAQ
Q: What is the safe navigation operator (?) in Power Automate?
The safe navigation operator (?) prevents runtime errors when accessing properties that may not exist on an object or array element, returning null instead of throwing an error.
Q: When should I use item()?['property'] instead of item()['property']?
Use item()?['property'] whenever a property might be missing or undefined, so your flow doesn’t fail and handles missing values gracefully.
Q: Will using the safe navigation operator affect performance?
No. It has minimal performance impact and greatly improves the stability of your flows by avoiding unnecessary errors.
🔗 Related Tips
🔸 #PowerPlatformTip 33: ‘Coalesce’ - pair ? with coalesce() to also supply a fallback value instead of null.
🔸 #PowerPlatformTip 104: ‘Efficient JSON Handling’ - build a null-tolerant Parse JSON schema for the same inconsistent data.
This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy – live Power Platform workshops, free or CHF 49. Join the workshop waitlist to get notified about new dates. For companies that want this implemented for them, see KMUpower – Power Platform consulting & automation for SMEs (DACH).