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

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! 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

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

32 REPLIES 32
Anonymous
Not applicable

Hey DarenD,

 

I have ran into issues trying to evaluate too much in one expression condition - even if everything makes logical sense. Now I split up more steps, both Flow and my coworkers seem to like it better.

 

I would

  1. Initialize a boolean Variable outside the loop
  2. Then inside your Apply to each, Set the Variable something like
    1. Set boolean Variable = not(empty(item()?['Funded_x0020_End_x0020_Date']))
  3. Add another conditional branch where if the Fund date is TRUE (not empty) continue on to your other within 10 days condition, else do nothing

Capture.PNG

Sooo...what action/condition am I looking for to create the variable?  I can't seem to find it in the FLOW actions.

Oh my gosh....as soon as I posted this I found it. Sorry. 

Charles_John,

     I think I've followed the instructions provided but can't find the "true" boolean value. What am I missing?

 

VariableIssue.png

I basically do the same exact thing in my Flow. I first check if the date field on this SharePoint list is NOT blank with the following code inside a condition:

 

@not(empty(triggerBody()?['column name goes here']))

(the above is under an Apply to Each, just like you have it). So, if it is empty, nothing happens, if it is NOT empty, it goes to another condition where it checks if the date from the list is 30 days away from today or not. If it is not, nothing happens, if it IS 30 days away from today, I get an e-mail reminder sent to me.

 

@equals(formatDateTime(item()?['Nextauditdue'], 'MM/dd/yyyy'), formatDateTime(addDays(utcNow(), 30), 'MM/dd/yyyy'))

I must be missing something, because I've got a Definition Error (see arrow) and I can't find "true" in condition value.

 

VariableIssue2.png

Hey @DarenD

 

I actually use it without the variable initilization and true/false checking. I just add a condition under the Apply to each step and go to edit in advanced mode and paste the code in there. Also make sure the title of your column is correct but it looks like you've already done this from your screenshot.

Ah, let me try that and see if I can kick start this bad boy!

krisof805,

 The FLOW ran but I didn't get a notice and I've got one date set to 8/21/2018 (trying to test for just 1 day to see if I can get it to work).  Please see the two pix below:

 

Something Didn't workSomething Didn't workNot sure if code is incorrectNot sure if code is incorrect

@DarenD

 

I think your first screenshot indicates that the Flow didn't get to that step because the item was empty in that particular instance?

 

The second screenshot has your date out 10 days, and not 1, if I am not mistaken. I think you would need a date for 8/30/2018 or 8/31/2018 for the Flow to evaluate to true and send you an e-mail.

 

 

Anonymous
Not applicable

@DarenD

 

The not(empty(item()?['Funded_x0020_End_x0020_Date'])) needs to be an expression, or use the @ operator as I think you did in your next attempt

 

Capture6.PNG

 

 

Anonymous
Not applicable

@DarenD

 

Using this approach you are referring to the wrong object.

@not(empty(triggerBody()?['RD_x0020_Funded_x0020_Expiration_x0020_Date'])) 

 

You want to referrence each element in the loop. Use below instead:

@not(empty(items('Apply_to_each')?['RD_x0020_Funded_x0020_Expiration_x0020_Date'])) 

 

Using the Expression and Dynamic Content tab to select your elements and build your formulas will help avoid the incorrect objects.

 

 

For your second box highlighting the comparision value in the condition, again, you can type in true in the Expression fx box. I think you can also directly just type in true to the comparision text box.

So I'm now a bit confused.  This is due to me being so new at FLOW but this is clearly an important issue for me to get fixed as I'll be using it in several other FLOWs.  

 

Charles_John,

    I added the code where you recommended, I believe, and it did run but no notice went out. I feel like I'm super close and just missing somethign small. You and Kristof805 are being super helpful and patient and I really, really appreciate it!!! 

 

So I have file in my library with an RD Funded Expiration Date of 8/22/2018, this is my test file.   

 

In my "Apply to Each" Action I have the first condition of:

 @not(empty(items('Apply_to_each')?['RD_x0020_Funded_x0020_Expiration_x0020_Date'])) 

 

If YES then second condition of:

 @equals(formatDateTime(item()?['RD_x0020_Funded_x0020_Expiration_x0020_Date'], 'MM/dd/yyyy'), formatDateTime(addDays(utcNow(), 1), 'MM/dd/yyyy'))

 

If RD Funded Expiration Date is 1 day ahead (YES) then send an e-mail.  What am I missing?

 

CodeIssue3.png

@DarenD

 

Your code looks good to me! Have you checked any of your runs for what is inside the Get files (properties only) -> Outputs -> Body results? That shows all the stuff your Flow is getting back from your files, you should see your dates there.

 

Have you tried a test run or two with this latest setup? Do you get a failure? Runs okay but no e-mails?

Anonymous
Not applicable

Hi DarenD,

Glad to help! Couple suggestions:

 

1. Add an action on the No/False branch of your condition to help in debuging. Then you'll be able to see if the condition isn't being evaluated as expected. This is why I also recomend Initializing/Setting variables. It's easier to see what's happening when debugging.

  • Note that your comparing sharepoint dates - which i'm assuming aren't entered in UTC time - against UTC now. I don't think this is the error in this case, but may cause timing differences in the future depending on what region you're in.

2. I would suggest building expressions using the Dynamic content selections and Expression formula until you're more familiar with objects. This will ensure you have correct references.

Capture.PNG

 

  • In your second condition is this giving you your expected value?
    •  @equals(formatDateTime(item()?['RD_x0020_Funded_x0020_Expiration_x0020_Date'], 'MM/dd/yyyy'), formatDateTime(addDays(utcNow(), 1), 'MM/dd/yyyy'))
  • I think it might, but you could change to 
    •  @equals(formatDateTime(items('Apply_to_each')?['RD_x0020_Funded_x0020_Expiration_x0020_Date'], 'MM/dd/yyyy'), formatDateTime(addDays(utcNow(), 1), 'MM/dd/yyyy'))

 

I just tried to make sure everything is working and it is with the following code and item with the date of 9/20/2018 (that's 30 days away from today according to Flow):

 

Expiration.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If the a date does end up being empty, the 30 days away step will throw and error saying that it did not get to that step but overall the Flow calls the run a success and so do I.

Charles_John,

    I added an e-mail in the first condition and recieved 200+ e-mails on items that had blank funding date fields. So that part works. However, the next condition isn't working properly. Even when I added your code updates.  See below:

email1.pngCodeIssue4.png

@DarenD I think that means that the Flow did not make it to that step (which is fine .. if a date is blank you can't compare it to a date from 30 days from now) but @Anonymous sounds like they know more than me. 

 

So the blank date part is working. Did you set any dates to 8/22/2018 so you would get a single e-mail if the Yes side of the condition evaluates?

Yes, I have 1 file with that date for testing purposes.  I think FLOW hates me! LOL! 

Helpful resources

Announcements

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Users online (4,374)