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

Terminate Flow when no data meets condition

Hi All,

So I have all my flows set up nicely. Just noticed something so I have the following set up. 

 

Flow basically looks for due date tomorrow and then send an email (using filter query).

gardnerlhwrc_0-1647435724212.png

 

 

What I've noticed is that it sends an email even if there is no data.

 

How can I make it go that little extra mile and it doesn't proceed if there isn't any data. I've tried using a control but then it adds an 'Apply to each' which then results in an email getting sent for each item with the HTML table

 

Thanks L

1 ACCEPTED SOLUTION

Accepted Solutions
fchopo
Super User
Super User

Hi @gardnerlhwrc 

You can get the number of items of the SharePoint "Get items" action, and if it's bigger than 0, then proceed to send the email.

So, to get the number of items you would use the following expression:

length(body('get_items')?['value'])

And use it inside a condition (bigger than 0) just before the select action (and put all the other actions inside the "yes" branch).

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

View solution in original post

3 REPLIES 3
KvB1
Solution Sage
Solution Sage

You could implement a condition that checks whether the value of the get items action has a length of greater than 0

fchopo
Super User
Super User

Hi @gardnerlhwrc 

You can get the number of items of the SharePoint "Get items" action, and if it's bigger than 0, then proceed to send the email.

So, to get the number of items you would use the following expression:

length(body('get_items')?['value'])

And use it inside a condition (bigger than 0) just before the select action (and put all the other actions inside the "yes" branch).

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
gardnerlhwrc
Helper II
Helper II

Amazing thank you all.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,991)