5 min readRishi

Handling Null and Blank Date Fields in Power Automate

In this series: Power Automate gotchas

Handling Null and Blank Date Fields in Power Automate

Checking whether a date field is blank in Power Automate is trickier than a null comparison. The same empty cell arrives as null, "", 0, 1900-01-01, or 0001-01-01T00:00:00Z depending on the connector. A condition that only tests equals(..., null) will pass on Dataverse and fail on SharePoint, then fail again when someone pastes the flow onto an Excel table.

This post is the checklist I use before I trust a date gate in production.

What "empty" actually is

When you pull a date from a connector, an unset value can appear as:

SourceTypical empty shapeAlso seen
Dataversenull0001-01-01T00:00:00Z on some datetime columns after a failed import
SharePoint""Missing property if the column was not in the view
SQL Servernull1900-01-01 from older schemas and default constraints
Excel""Serial 0, which some actions render as 1899-12-30
Forms / HTTP JSONmissing propertynull if the sender included the key

A simple equals(field, null) misses the string and sentinel cases. empty() alone misses a real timestamp that happens to be the sentinel. You need both a "no value" test and a "this is a dummy date" test.

The portable expression

Use empty() around coalesce() so null and "" collapse to the same thing:

@empty(coalesce(triggerOutputs()?['body/dateField'], ''))

If the field is null, coalesce falls back to an empty string, and empty() returns true. If the field is already "", coalesce keeps it and empty() is still true. If the field is a real ISO timestamp, empty() is false.

The ? on the path matters. Without it, a missing property fails the expression and the run errors instead of taking the "blank" branch. That is the same path-safety habit as runtime null handling.

Sentinels: 0001-01-01, 1900-01-01, Excel 0

Some connectors return a date instead of null. Add an explicit check for the dummy values you have actually seen in the trigger output — do not guess a list of every epoch in computing.

@or(
  empty(coalesce(triggerOutputs()?['body/dateField'], '')),
  equals(formatDateTime(triggerOutputs()?['body/dateField'], 'yyyy-MM-dd'), '0001-01-01'),
  equals(formatDateTime(triggerOutputs()?['body/dateField'], 'yyyy-MM-dd'), '1900-01-01'),
  equals(formatDateTime(triggerOutputs()?['body/dateField'], 'yyyy-MM-dd'), '1899-12-30')
)

formatDateTime on a true empty string throws. That is why the empty(coalesce(...)) clause comes first, and why this expression belongs in a Condition that short-circuits, or in a Compose that only runs after you know the value is present. If you put formatDateTime on a raw SharePoint empty string, the run fails before the or can save you.

A safer two-step:

  1. Compose DateValue — @coalesce(triggerOutputs()?['body/dateField'], '')
  2. Condition — @or(empty(outputs('DateValue')), contains(string(outputs('DateValue')), '0001-01-01'), contains(string(outputs('DateValue')), '1900-01-01'), contains(string(outputs('DateValue')), '1899-12-30'))

contains on the string form avoids calling formatDateTime on garbage. It is uglier. It does not throw.

Filter at the trigger, not after

If the flow should not run when the date is empty, do not detect it in a Condition action. A Condition still starts a run and still counts against Power Platform request limits. Use the connector's filter or a trigger condition.

Dataverse Filter rows on the trigger:

datefield eq null

That is OData. Use the logical name, not the display name. Choice and lookup columns have different empty tests; dates are eq null.

SharePoint list trigger condition (Settings on the trigger):

@not(empty(triggerOutputs()?['body/DateField']))

SharePoint's body uses the internal column name. If you just renamed the column, the body key is still the old internal name. Take one unfiltered run and read the output.

Skipping the run is cheaper than starting it and terminating. It also keeps run history readable: every row in history is a row that had a date.

Dataverse condition cards

With the current Dataverse connector, a Condition card can compare a date field to null by leaving the value blank and choosing is equal to. That works for Dataverse null. It still fails for SharePoint empty strings, Excel serial 0, and SQL 1900-01-01.

If the flow might be reused across connectors, keep empty(coalesce(...)) plus the sentinel check. If the flow is Dataverse-only and the column is a real datetime with no import garbage, the blank Condition card is enough — and easier for the next person to read.

Excel-specific: serial zero

Excel Online (Business) often gives you a number, not an ISO string, when the cell is a date format. An empty-looking cell can be 0. empty(0) is false because 0 is a value. Test the number before you format it:

@or(empty(coalesce(items('Apply_to_each')?['DueDate'], '')), equals(items('Apply_to_each')?['DueDate'], 0))

If a later action needs a timestamp, only call addDays('1899-12-30', int(serial)) after that check. Converting 0 first and then testing the formatted date works, but you have already invented 1899-12-30 and you will forget why it is in the run.

What I do not do

  • I do not compare dates with equals(..., '') on Dataverse. Dataverse sends null.
  • I do not use ticks() on a value I have not proven is a date. ticks('') fails the run.
  • I do not treat "date is in the past" as a blank check. A real 2019 close date is not empty.
  • I do not copy the same expression across three connectors without opening one payload from each.

Key takeaway

Never trust a single null check for dates across connectors. empty(coalesce(...)) handles null and "". A second clause handles the dummy timestamps your source actually emits. Prefer Filter rows or a trigger condition when the flow should not start. Read one trigger body before you write the expression — the property name and the empty shape are in that JSON, not in the designer label.

Keep reading

Newsletter

New posts, straight to your inbox

One email when a new post goes up. Double opt-in, unsubscribe anytime. Not a daily digest.

Comments

  • No comments yet. Be the first.