cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SteveTaylor
Helper I
Helper I

Multiple Conditions in a Flow (including date) from a List

Hi,

 

I have a simple flow that I want to trigger a chaser email if 2 criteria are met: 1) Status column = Pending / 2) Due Date column = today's date (this is a calculated field in the List). The Flow runs, however, doesn't generate any output when looking at the date. It works fine if the criteria is just 'Pending'. I think the issue may be around the date being pulled from the List and have tried using the 'formatDateTime' expression, but to no avail. 

 

Any suggestions would be very welcome. 

 

Thanks in advance,

 

Steve

SteveTaylor_0-1653919910178.png

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Pstork1
Most Valuable Professional
Most Valuable Professional

Its not your time zone that counts.  Its the time zone for where the SharePoint server is located.  Check in the Site Settings > regional settings to see what the time zone is.

 

Without more access to your flow I can't tell you what the code should look like exactly.  It will be something with Item() instead of TriggerBody().  If you insert the DueDate field into the compose by itself that should show you what the code should be exactly.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

@Pstork1  Changing triggerBody() to Item() and amending the source column to a fixed input date field (rather than calculated one that you highlighted can be unreliable) fixed the problem.

 

Thanks for all your help with this - much appreciated! 

 

Steve

View solution in original post

13 REPLIES 13
Pstork1
Most Valuable Professional
Most Valuable Professional

The problem is that the DueDate and UTCNow() both contain a date and a time.  If the times don't match then they aren't equal.  If you add a formatDateTime() to each side and format them both as 'yyyy-MM-dd'. Then the condition will work.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1  Thanks for the quick reply.

 

What would the expressions look like - I have tried the following but still learning expressions:

Trigger: formatDateTime(triggerBody()'[duedate]', 'yyyy-MM-dd')

Result: formatDateTime(utcNow(),'yyyy-MM-dd')

 

The List shows the date with the format 'dd/mm/yyyy'

 

Many thanks for your help,

 

Steve

 

 

Pstork1
Most Valuable Professional
Most Valuable Professional

It doesn't really matter which format you use as long as it is consistent on both sides of the condition.  The ones you've listed look correct.  You can also use 'dd/MM/yyyy' if you prefer.  The capital MM is important since 'mm' will pull in the minutes not he month.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 Thanks for the reply. I've updated the expressions as suggested and it runs, but again, no output: 

 

It runs fine when just looking at the Status column, but not when I introduce the Due Date. I have not seen this result where the flow runs, but not even showing 'false' results on the Conditions. Unsure what I am missing here?

 

Thanks again for your ongoing help with this - much appreciated. 

Steve

 

SteveTaylor_0-1653922154941.png

 

Pstork1
Most Valuable Professional
Most Valuable Professional

You said in your original post that due date was a calculated field.  Do you mean its calculated by SharePoint?  Or its calculated in the flow?  Add a compose before the condition at the top of the loop and check what actual values are being returned.  The greyed out Apply to Each would suggest that your Get items isn't getting any records.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 I'll try adding the Compose in and see if that helps. In the meantime, if I select the date condition as the only parameter it gives the error message below - Is this pointing to the actual issue, ie the issue is the Sharepoint date being a calculated result rather than an inputted date?

 

InvalidTemplate. Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.

 

 

The calculated result is within Sharepoint - pulls the date from another column and adds 21 days:

 

SteveTaylor_0-1653923740247.png

 

Thanks,

 

Steve

 

 

 

 

 

Pstork1
Most Valuable Professional
Most Valuable Professional

The Compose won't fix anything, but it will tell you what the values actually are that you are trying to compare.  The issue is the Due Date calculated field.  Calculated fields are usually unreliable in Power apps.  Add the compose and we'll see what value is actually coming in.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 I think the data is pulling through ok from the List (copy of Compose input/output below). I changed the trigger field to a static input (1stChaser column) and it comes up with the same error message as above:

 

SteveTaylor_1-1653924822891.png

 

Interestingly, the calculated field result is actually showing 29 May, rather than 30 May on the List. Not sure if that is the root cause, however, as the same issue occurs with a manually input date.

 

Thanks,

 

Steve

Pstork1
Most Valuable Professional
Most Valuable Professional

The May 29 vs 30 is because SharePoint displays it shifted for your time zone.  The May 29 is UTC.  I assume you are somewhere in North America.  This is a common thing. Flow always retrieves the actual stored value, which will be in UTC.  SharePoint retrieve the same value, but then converts it for the time zone of the site.  Midnight local time would be yesterday in UTC in North America.

 

The problem in the condition is that you are using the wrong column name.  That's why its null.  Your post said you are using 

formatDateTime(triggerBody()'[duedate]', 'yyyy-MM-dd')

It should be

formatDateTime(triggerBody()['Due_x0020_Date'], 'yyyy-MM-dd')


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 

 

My timezone is UTC but it should show the same date?

 

I updated the expressions to the below and got a slightly different error message: 

Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language expression 'formatDateTime(triggerBody()['Due_x0020_Date'], 'yyyy-MM-dd')' cannot be evaluated because property 'Due_x0020_Date' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

 

 

formatDateTime(triggerBody()['Due_x0020_Date'], 'yyyy-MM-dd')
formatDateTime(utcNow(),'yyyy-MM-dd')
 
Thanks,
 
Steve

 

@Pstork1 

 

My timezone is UTC but it should show the same date?

 

I updated the expressions to the below and got a slightly different error message: 

Unable to process template language expressions for action 'Condition' at line '0' and column '0': 'The template language expression 'formatDateTime(triggerBody()['Due_x0020_Date'], 'yyyy-MM-dd')' cannot be evaluated because property 'Due_x0020_Date' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

 

 

formatDateTime(triggerBody()['Due_x0020_Date'], 'yyyy-MM-dd')
formatDateTime(utcNow(),'yyyy-MM-dd')
 
Thanks,
 
Steve

 

Pstork1
Most Valuable Professional
Most Valuable Professional

Its not your time zone that counts.  Its the time zone for where the SharePoint server is located.  Check in the Site Settings > regional settings to see what the time zone is.

 

Without more access to your flow I can't tell you what the code should look like exactly.  It will be something with Item() instead of TriggerBody().  If you insert the DueDate field into the compose by itself that should show you what the code should be exactly.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1  Changing triggerBody() to Item() and amending the source column to a fixed input date field (rather than calculated one that you highlighted can be unreliable) fixed the problem.

 

Thanks for all your help with this - much appreciated! 

 

Steve

Helpful resources

Announcements

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community 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  

Tuesday Tip | How to Report Spam in Our Community

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.   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!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (3,808)