cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DarenD
Helper II
Helper II

How to check if a field (date) is blank AND it is within a specific number of days then send email

I have a business process where I need to take the following steps....just not sure how to code it in FLOW:

 

Step 1: Determine if [Funded End Date] is NOT blank

Step 2: IF [Funded End Date] field IS blank do nothing  

Step 3: IF NOT blank determine if [Funded End Date] is 1 day greater than today

Step 4: If YES send an e-mail to specific people | If NO do nothing

 

Run this everyday at a specific time

 

This seems to be a pretty standard problem and I've used this code @equals(formatDateTime(item()?['Funded_x0020_End_x0020_Date'], 'MM/dd/yyyy'), formatDateTime(addDays(utcNow(), 10), 'MM/dd/yyyy'))   before to send notices.

 

The issue I'm running into is that the not all the Funded End Date fields have data, and won't.  So I the first part of the code throws an error becuase it's trying to evaluate a blank field

 

FLOW Blank Field Issue.png

 

Thanks in advance for any help! 🙂

30 REPLIES 30

@DarenD If you have right date, then you should get an e-mail if both the first condition and the second condition evaluates true. Can you find any where both are true? Or at least the first condition?

So I moved the e-mail notice above the next condition and I did get a notice, but only one and only for the item with the closed due date (8/30/2018).  I have about 100 items with funding expiration dates so I'm wondering if there's an issue with the first evaluation as well? 

 

CodeIssue5.png

Hmm .. something's not right. The way you had it setup in the post, you should get an e-mail everytime there is a date, regardless what that date is, since the date compare function is after your e-mail.

That's what I thought as well. 

Charles_John,

    Since I have 3 of these workflow that I need with different dates I'm still working on using the variable option as well. However, I messed it up somewhere:

 

VariableIssue3.pngVariableIssue4.png

Soooooo....I guess we can't really do the check?

I'm not familiar with the variables but the error looks like you are putting a string value somewhere where Flow expects a boolean. Once you initialize the variable, I don't think you'd need to set it, you'd just compare with the Condition step and see if it evaluates true or not.

 

I've only done a Flow like this without a variable. Sorry I can't help you further. Your formulas look good to me.

Thanks Kristof805! 🙂

Beat
Helper V
Helper V

I came across a similar issue today and couldn't find a solution in the community, but then found a workaround that may be of interest for some users for determining if a date field is blank:

 

Value(Today()) - Value('Due Date') = Value(Today()) returns True if Due Date is blank.

 

View solution in original post

YatinMumbai
Advocate IV
Advocate IV

To check if Date is empty, you don't need empty() or any other function on the date itself. In the condition, select the SharePoint column (or your data source) directly from Dynamic content. Set criteria to Is Equal to or Is Not Equal To as per requirement. In the compare box select the Expression as null.  Do not enter 'null' or null or leave blank. Enter null in expression, select the function and click OK.

It should show like this as a function -

null.png

Westly
Advocate II
Advocate II

You can use the value function to change the date to a number. If that number is zero then its blank (most likely as the value of an empty date/time column's epoch time is 01/01/1970).

If(Value(yourDateHere)=0, "Date is Blank", "Date is not Blank")

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Kudoed Authors
Users online (3,252)