Check iF value null in Power Automate
When you're working with fields that may be blank or null, you need to protect your expressions using functions that handle nulls gracefully otherwise, your flow will fail.
The best approach is to use the coalesce()
function, which returns the first non-null value from the list you give it.
Example using coalesce()
Instead of this (which fails if the value is null):
toLower(triggerOutputs()?['body/Comments'])
Use this:
toLower(coalesce(triggerOutputs()?['body/Comments'], 'No comments provided'))
This means:
- If Comments has a value → use it
- If it's null → use "No comments provided" instead
Other Helpful Functions
use empty()
to Checks if a field is null or empty
if(empty(triggerOutputs()?['body/Comments']), 'N/A', triggerOutputs()?['body/Comments'])
Best Practice Tips
- Always wrap expressions using dynamic content (especially from SharePoint or Dataverse) in coalesce() or if() when you're not sure if the field will always have a value.
- If you're using a field in an email body, condition, or string conversion, it's safer to assume it might be null.