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.
Thanks in advance for any help! 🙂
Solved! Go to Solution.
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.
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 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 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.
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:
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.
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
Using this approach you are referring to the wrong object.
You want to referrence each element in the loop. Use below instead:
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.
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:
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?
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?
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.
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.
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):
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.
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:
@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?
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.