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

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT).     This is an incredible opportunity to connect with members of the Copilot Studio product team and ask them anything about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendars now because you will not want to miss the conversation.   This live event will give you the unique opportunity to learn more about Copilot Studio plans, where we’ll focus, and get insight into upcoming features. We’re looking forward to hearing from the community, so bring your questions!   TO GET ACCESS TO THIS EXCLUSIVE AMA: Kudo this post to reserve your spot! Reserve your spot now by kudoing this post.  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today.   Invitations will be sent on April 2nd.Users posting Kudos after April 2nd at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendars for April 3, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Unlocking Community Achievements and Earning Badges

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!     THIS WEEK'S TIP: Unlocking Achievements and Earning BadgesAcross the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. These badges each signify a different achievement--and all of those achievements are available to any Community member! If you're a seasoned pro or just getting started, you too can earn badges for the great work you do. Check out some details on Community badges below--and find out more in the detailed link at the end of the article!       A Diverse Range of Badges to Collect The badges you can earn in the Community cover a wide array of activities, including: Kudos Received: Acknowledges the number of times a user’s post has been appreciated with a “Kudo.”Kudos Given: Highlights the user’s generosity in recognizing others’ contributions.Topics Created: Tracks the number of discussions initiated by a user.Solutions Provided: Celebrates the instances where a user’s response is marked as the correct solution.Reply: Counts the number of times a user has engaged with community discussions.Blog Contributor: Honors those who contribute valuable content and are invited to write for the community blog.       A Community Evolving Together Badges are not only a great way to recognize outstanding contributions of our amazing Community members--they are also a way to continue fostering a collaborative and supportive environment. As you continue to share your knowledge and assist each other these badges serve as a visual representation of your valuable contributions.   Find out more about badges in these Community Support pages in each Community: All About Community Badges - Power Apps CommunityAll About Community Badges - Power Automate CommunityAll About Community Badges - Copilot Studio CommunityAll About Community Badges - Power Pages Community

Tuesday Tips: Powering Up Your Community Profile

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week's Tip: Power Up Your Profile!  🚀 It's where every Community member gets their start, and it's essential that you keep it updated! Your Community User Profile is how you're able to get messages, post solutions, ask questions--and as you rank up, it's where your badges will appear and how you'll be known when you start blogging in the Community Blog. Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile.     Password Puzzles? No Problem! Find out how to sync your Azure AD password with your community account, ensuring a seamless sign-in. No separate passwords to remember! Job Jumps & Email Swaps Changed jobs? Got a new email? Fear not! You'll find out how to link your shiny new email to your existing community account, keeping your contributions and connections intact. Username Uncertainties Unraveled Picking the perfect username is crucial--and sometimes the original choice you signed up with doesn't fit as well as you may have thought. There's a quick way to request an update here--but remember, your username is your community identity, so choose wisely. "Need Admin Approval" Warning Window? If you see this error message while using the community, don't worry. A simple process will help you get where you need to go. If you still need assistance, find out how to contact your Community Support team. Whatever you're looking for, when it comes to your profile, the Community Account Support Knowledge Base article is your treasure trove of tips as you navigate the nuances of your Community Profile. It’s the ultimate resource for keeping your digital identity in tip-top shape while engaging with the Power Platform Community. So, dive in and power up your profile today!  💪🚀   Community Account Support | Power Apps Community Account Support | Power AutomateCommunity Account Support | Copilot Studio  Community Account Support | Power Pages

Super User of the Month | Chris Piasecki

In our 2nd installment of this new ongoing feature in the Community, we're thrilled to announce that Chris Piasecki is our Super User of the Month for March 2024. If you've been in the Community for a while, we're sure you've seen a comment or marked one of Chris' helpful tips as a solution--he's been a Super User for SEVEN consecutive seasons!   Since authoring his first reply in April 2020 to his most recent achievement organizing the Canadian Power Platform Summit this month, Chris has helped countless Community members with his insights and expertise. In addition to being a Super User, Chris is also a User Group leader, Microsoft MVP, and a featured speaker at the Microsoft Power Platform Conference. His contributions to the new SUIT program, along with his joyous personality and willingness to jump in and help so many members has made Chris a fixture in the Power Platform Community.   When Chris isn't authoring solutions or organizing events, he's actively leading Piasecki Consulting, specializing in solution architecture, integration, DevOps, and more--helping clients discover how to strategize and implement Microsoft's technology platforms. We are grateful for Chris' insightful help in the Community and look forward to even more amazing milestones as he continues to assist so many with his great tips, solutions--always with a smile and a great sense of humor.You can find Chris in the Community and on LinkedIn. Thanks for being such a SUPER user, Chris! 💪 🌠  

Tuesday Tips: Community Ranks and YOU

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!This Week: Community Ranks--Moving from "Member" to "Community Champion"   Have you ever wondered how your fellow community members ascend the ranks within our community? What sets apart an Advocate from a Helper, or a Solution Sage from a Community Champion? In today’s #TuesdayTip, we’re unveiling the secrets and sharing tips to help YOU elevate your ranking—and why it matters to our vibrant communities. Community ranks serve as a window into a member’s role and activity. They celebrate your accomplishments and reveal whether someone has been actively contributing and assisting others. For instance, a Super User is someone who has been exceptionally helpful and engaged. Some ranks even come with special permissions, especially those related to community management. As you actively participate—whether by creating new topics, providing solutions, or earning kudos—your rank can climb. Each time you achieve a new rank, you’ll receive an email notification. Look out for the icon and rank name displayed next to your username—it’s a badge of honor! Fun fact: Your Community Engagement Team keeps an eye on these ranks, recognizing the most passionate and active community members. So shine brightly with valuable content, and you might just earn well-deserved recognition! Where can you see someone’s rank? When viewing a post, you’ll find a member’s rank to the left of their name.Click on a username to explore their profile, where their rank is prominently displayed. What about the ranks themselves? New members start as New Members, progressing to Regular Visitors, and then Frequent Visitors.Beyond that, we have a categorized system: Kudo Ranks: Earned through kudos (teal icons).Post Ranks: Based on your posts (purple icons).Solution Ranks: Reflecting your solutions (green icons).Combo Ranks: These orange icons combine kudos, solutions, and posts. The top ranks have unique names, making your journey even more exciting! So dive in, collect those kudos, share solutions, and let’s see how high you can rank!  🌟 🚀   Check out the Using the Community boards in each of the communities for more helpful information!  Power Apps, Power Automate, Copilot Studio & Power Pages

Find Out What Makes Super Users So Super

We know many of you visit the Power Platform Communities to ask questions and receive answers. But do you know that many of our best answers and solutions come from Community members who are super active, helping anyone who needs a little help getting unstuck with Business Applications products? We call these dedicated Community members Super Users because they are the real heroes in the Community, willing to jump in whenever they can to help! Maybe you've encountered them yourself and they've solved some of your biggest questions. Have you ever wondered, "Why?"We interviewed several of our Super Users to understand what drives them to help in the Community--and discover the difference it has made in their lives as well! Take a look in our gallery today: What Motivates a Super User? - Power Platform Community (microsoft.com)

Users online (7,388)