web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to stop flow from ...
Power Automate
Answered

How to stop flow from failing if filter didn't find anything

(0) ShareShare
ReportReport
Posted on by 17

Hello

 

I'll start off by saying that I don't know much about Power Automate and have mainly just been following a guide on how to make my specific flow, so I'm sorry if there is an obvious answer to this!

 

So I have a flow set up that automatically checks an excel sheet with various tasks and their deadlines and if it finds a deadline coming up within a certain amount of days it sends a reminder to the responsible person.

 

The way it works is that it checks one column to see if a task is marked as done or still in progress.

If it's still in progress it looks whether the deadline is exactly 30 or 14 days from now. If it is then it grabs the email from another column and sends the reminder.

This check runs every morning.

 

The problem is that it's far from every day that there is a deadline coming up and if there isn't then the flow fails. After 2 weeks of continous fails the flow automatically shuts off. 

Is there some action I can add to my flow so that it doesn't fail, but simply ends if nothing is found matching the filters?

 

Thanks in advance!

Categories:
I have the same question (0)
  • MarconettiMarco Profile Picture
    3,812 Super User 2024 Season 1 on at

    Hello @MatiasN ,

    please share your flow in edit mode and the error you're getting, so that we could better help you.

    BR,

    Marco

  • MatiasN Profile Picture
    17 on at

    Hi @MarconettiMarco 

     

    Thank you for taking the time to help me! 🙂

     

    Here is an image of the flow and error message

     

    When the filter doesn't find anything the composes fail.When the filter doesn't find anything the composes fail.Part 1 of the flowPart 1 of the flowPart 2 of the flowPart 2 of the flow

  • MarconettiMarco Profile Picture
    3,812 Super User 2024 Season 1 on at

    Hello @MatiasN ,

    please try to use this expression:

    substring(variables('email list'),0,add(length(variables('email list')),-1))

     

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

    BR,

    Marco

  • MatiasN Profile Picture
    17 on at

    Hi @MarconettiMarco 

     

    Unfortunately that gives the same error message.

    It seems to me that the problem is that there's nothing for the compose steps to work with because nothing was found for that specific day with the conditions chosen. Afterall you can't remove the last character if there are no characters to begin with. 

    Is there some way to tell the flow to simply stop early if nothing was found?

  • MarconettiMarco Profile Picture
    3,812 Super User 2024 Season 1 on at

    Hello @MatiasN ,

    do you want to terminate the run if the "email list" variable is empty?

     

    BR,
    Marco

  • MatiasN Profile Picture
    17 on at

    Hi @MarconettiMarco 

     

    Does terminate mean that the flow will not go further for that day and then try again at the next set recurrence? If so that sounds like it could fix the problem.

  • Verified answer
    MarconettiMarco Profile Picture
    3,812 Super User 2024 Season 1 on at

    yes @MatiasN ,

    so you can for sure filter the excel rows with the email column not null, otherwise after your "Apply to each" control, add the "Condition" if the output of this expression length(variables('email list')) is greater than 0: if Yes, follow your Compose actions, if No Terminate.

     

     

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

    BR,

    Marco

  • MatiasN Profile Picture
    17 on at

    Hi @MarconettiMarco 

     

    So what I believe is failing is that the filter looks for a date in the Deadline column that is todays date +14 and then it sees if the Status column is "In Progress" or "Pending". If such an entry exists it collects the email address in the Email column. Since there might be multiple emails in the same cells it then splits them at the ";".

    What this all means is that if there is no In Progress/Pending deadline 2 weeks from the day the flow runs, then the filter output simply becomes [] and  all the compose steps fail because they have no data to work with.

    So it's not that there are null values in Excel, but that there are no entries matching the filters.

     

    I tried adding the condition after Apply to Each as you suggested, but unfortunately it still fails. I believe maybe the condition has to come earlier in the flow? This is what it shows:

    Error2.png

     

    So I tried putting a condition right after the step that generates the empty data, but I get this error:

     

    Error3.png

     

  • MarconettiMarco Profile Picture
    3,812 Super User 2024 Season 1 on at

    ok @MatiasN ,

    please send the "Condition" screenshot in edit mode.

     

    BR,

    Marco

  • MatiasN Profile Picture
    17 on at

    Sorry @MarconettiMarco I had missed the "length" part of the expression, so I tried it again and it works perfectly now. Thank you so much for all your assistance and patience!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard