How to Check If a Date is Blank in Power Automate?

Are you struggling to check if a date is blank in Power Automate or Microsoft Flow? Then This Power Automate tutorial will help you to apply the condition if a Date is Blank or Not using the Power Automate flow.

In addition, we will also cover how we can initialize variables and apply the condition to check whether the date value is Blank or not.

Check If a Date is Blank in Power Automate

Here we will see how to apply the condition if a date is blank in Power Automate flow or Microsoft flow.

For that, we will create a condition action to check if the TaskCompleted date column which is of date data type is blank or not. And the Power Automate flow will trigger when a new item is created or the existing item is modified on the SharePoint list.

Follow the below steps to achieve this:

  • Create a new automated flow by selecting +New flow -> Automated flow then enter the flow name.
  • Choose the trigger when an item is created or modified and click on the create option.
  • Configure the trigger with the Site Address and List Name here I have selected my SharePoint site and the SharePoint list Name (TaskList).
Example of Power Automate condition if blank
Example of Power Automate condition if blank
  • Select plus sign (+New Step)-> Add an action to compose the data operation to check whether the date column is blank or not.
  • Apply the below-mentioned formula under the Expression tab to add the input in the compose data operation.
empty(triggerOutputs()?['body/TaskCompletedDate'])
Power Automate condition if a date is blank
Power Automate condition if a date is blank
  • Click on the Next step and select condition control action to check if the task completed date column has an empty value or not.
  • Then we will add the condition if the compose data operation output value is equal to empty then it returns true value else false value.
Output  is equal to True
  1. Output Value is dynamic content value
  2. Operator: is equal to
  3. value: True
Power Automate condition if a date is blank example
Power Automate condition if a date is a blank example

Save the flow and Click the flow checker to check if any error occurs in the flow or not. If there is no error Select Test-> Manually-> Save & Test.

Check If a Date is Blank in Power Automate
Test Power Automate

Now we will modify the existing item in the SharePoint list, with the empty Task completed date value blank as below:

Example of Power Automate condition if a date is blank
Example of Power Automate condition if a date is blank

In the below screenshot, you can see it returns a true value because the TaskCompleted date column contains a blank value.

condition if a date is blank in Power Automate
condition if a date is blank in Power Automate

In the same way, if we modify an item that contains the task completed date value as highlighted below:

condition if a date is blank using the Power Automate
condition if a date is blank using the Power Automate

The screenshot below displays and returns the false value because the TaskCompleted Date does not contain the blank value.

Example of condition if a date is blank using the Power Automate
Example of the condition if a date is blank using the Power Automate

This is how to apply the condition if a date is blank in the Power Automate flow.

See also  Power Apps combo box filter

Power Automate Empty Date Field

Let us see how we can find the Empty Date Field in the Power Automate flow.

We cannot format an empty date, The input of this expression must be always a valid string variable data type with a date. 

So here, we will initialize a variable with variable type as a string to get the input value from the SharePoint List. And we will add a condition action to display the results.

Follow the steps Illustrated below:

Step:1

  • Select +Create -> Automated flow. Enter the flow name Choose the trigger when an item is created or modified and click on the create option
  • Configure the trigger with the Site Address and List Name.
Power Automate Initialize Variable in Condition
Power Automate Condition If a Date is Blank

Step:2

  • Select plus sign (+New Step)-> Add an action to initialize a variable to check whether the Date column value is blank or not.
  • Enter the variable name and choose the variable type as String.
  • In the value section, add dynamic content, and Under the Expression tab, apply the below-highlighted formula and click ok.
if(empty(triggerOutputs()?['body/TaskCompletedDate']), null,formatDateTime(triggerOutputs()?['body/TaskCompletedDate'],'yyyy-MM-dd'))
Power Automate Empty Date Field
Power Automate Empty Date Field

Step:3

  • Click on the Next step and select condition control action, to find whether the date is blank or not.
  • If the Task Completed Date column is blank or empty then in the compose action we will display Yes, The date value is blank. Else, if it is blank or On-Hold status then in the compose action we will display No, The date value is not blank.
Power Automate Empty Date Field example
Power Automate Empty Date Field example

Step:5

  • Select Test-> Manually-> Save & Test to save and test the Power Automate flow.
  • Once the flow has been saved, we will modify an existing item in the SharePoint list to trigger the Power Automate flow, where the Task Completed Date has a Blank value:
Example of Power Automate Empty Date Field
Example of Power Automate Empty Date Field

In the below screenshot, we can see that the compose action displays the expected output based on the condition applied.

Power Automate blank Date
Power Automate blank Date

In the same way, we will modify an existing item in the SharePoint list, where the Task Completed Date contains a date value.

Example of Power Automate Date Field
Example of Power Automate Date Field

The Screenshot below displays the result in compose action based on the condition applied.

Power Automate blank Date example
Power Automate blank Date example

This is how to find the Empty Date Field in the Power Automate flow.

See also  How to Send Birthday Email using Power Automate?

In this Power Automate tutorial, we have discussed how to apply a condition to check if a Date is Blank or Not in a Power Automate flow. In addition, we also covered how to initialize variables and apply the condition to check whether the date value is Blank or not in Power Automate.

You may like the following Power Automate tutorials:

>