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).
- 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'])
- 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
- Output Value is dynamic content value
- Operator: is equal to
- value: True
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.
Now we will modify the existing item in the SharePoint list, with the empty Task completed date value blank as below:
In the below screenshot, you can see it returns a true value because the TaskCompleted date column contains a blank value.
In the same way, if we modify an item that contains the task completed date value as highlighted below:
The screenshot below displays and returns the false value because the TaskCompleted Date does not contain the blank value.
This is how to apply the condition if a date is blank in the Power Automate flow.
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.
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'))
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.
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:
In the below screenshot, we can see that the compose action displays the expected output based on the condition applied.
In the same way, we will modify an existing item in the SharePoint list, where the Task Completed Date contains a date value.
The Screenshot below displays the result in compose action based on the condition applied.
This is how to find the Empty Date Field in the Power Automate flow.
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:
- Power Automate Condition if a String is Empty
- Conditionally Update SharePoint list items using Power Automate
- Create PDF from Excel using Power Automate
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.