Skip to main content

Notifications

Power Automate - Building Flows
Answered

Flow showed as failed when it was successful but extremely slow

(0) ShareShare
ReportReport
Posted on by

Hi, my flow is an instant flow as below (I've blurred the sensitive information). 

ricelover_888_1-1712268679965.png

 

I have Excel files saved in a SharePoint folder for different people (file name convention = person's name + Month/Year) and I need to send these files to each of them via email. I also have an Excel table (Contact List) where I've got people's names, month/year, file names and email addresses.

 

What this flow does is that when I select the row (i.e., file name) from the Contact List, it looks for that file inside my SharePoint folder and send the file to the corresponding person via email.

 

Note that not all people get sent a file every month so the number of files to be sent each time will always less than the number of people in my Contact List.

 

My flow is running extremely slow and it took more than 3 min for each file to be sent. Although all files got sent eventually, it appeared to be failed in My Flow. I added "Terminate" when Failed at the end previously but it didn't help. I'm not sure where I did wrong.

ricelover_888_2-1712269223136.png

 

  • creativeopinion Profile Picture
    creativeopinion 10,135 on at
    Re: Flow showed as failed when it was successful but extremely slow

    @ricelover_888 As I mentioned before, this is because the Get Files (properties only) action will always return an array of files—even if it's only a single file. You need an expression to avoid the Apply to Each action. Refer to this section of my YT Tutorial on how to do that.

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
  • Re: Flow showed as failed when it was successful but extremely slow

    It automatically created an Apply to each step. I modified the File Identifier and it somehow works now.

  • creativeopinion Profile Picture
    creativeopinion 10,135 on at
    Re: Flow showed as failed when it was successful but extremely slow

    @ricelover_888 As mentioned previously, if you are only ever expecting a single file—you should avoid the Apply to each action as it's not necessary. Refer to this section of my YT Tutorial on how to do that.

     

    I can't tell which dynamic content you are using in the File Identifier field of the Get field content action. You'll need to ensure that it's the Identifier dynamic content.

    creativeopinion_0-1712274877721.png

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
  • Re: Flow showed as failed when it was successful but extremely slow

    Thanks. I applied your method and tested and successfully got 1 item per flow and the file returned was correct. However, I encountered an issue at Get file content. It said the file was not found.

    ricelover_888_1-1712274744503.png

     

     

     

     

     

  • creativeopinion Profile Picture
    creativeopinion 10,135 on at
    Re: Flow showed as failed when it was successful but extremely slow

    @ricelover_888 The error shows that the file wasn't found. If you'd like to filter on the File Name, you'll need to use FileLeafRef in you ODATA filter query. Also, here's a fun fact. The Get Files (properties only) returns folders as well. You need to use a Filter Query to return Files only. Refer to this YT Short.

     

    creativeopinion_1-1712269947626.png

     

    Whenever I use a Filter Query in a Get Files (properties only) action, I always like to return the count of items returned in a Compose action. This is helpful when building a flow and can also be used to troubleshoot your flow.

    Insert a Compose action. Add an Expression. Use the length() function.

    creativeopinion_2-1712270005951.png

     

    Select the Dynamic content tab and insert the value dynamic content from the Get Items action into the length() function.

    creativeopinion_3-1712270019950.png

     

    Run a test. Review the output of the Compose action. See if the filter query has returned any files, if not—the Compose action will output a zero.

     

    Condition Check

    Add a Condition action to your flow. If files have returned (aka there is number stored in the Compose action—that is not equal to 0), add the rest of your actions to the Yes branch. If not, do nothing.

    creativeopinion_4-1712270069470.png

     

    If you are only expecting 1 file to match, you'll want to avoid the Apply to Each action. Even if a single file has been returned from the Get files (properties only) action—it'll still return an array. 

     

    Take a look a this YT Tutorial: 3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow

    In this video tutorial I’ll go over how to avoid these common mistakes when using the Apply to Each action in a Power Automate flow:

     

    1️⃣ Looping through a Single Item

    2️⃣ Creating Unnecessary Nested Loops

    3️⃣ Looping through an Unfiltered Array

     

    At the end of the video I share a few helpful insights when it comes to using the Apply to Each action in your flow.

     

    IN THIS VIDEO:

     How to avoid the Apply to Each action with a single item array

     How to use the item() function to access dynamic content in an array

     How to prevent unnecessary nested Apply to Each action loops

     How to use the Select action

     How to convert an array to a string with the Select action

    How to use the Filter Query field

     How to count the number of items in an array

     How to use a condition control

     How to use the concurrency control

     How to set a top count

     How to use Compose actions for troubleshooting

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
  • Re: Flow showed as failed when it was successful but extremely slow

    Thanks for the solution. I'll give it a go. Screenshot below is the detail of a failed flow.

    ricelover_888_0-1712269614144.png

     

  • Verified answer
    creativeopinion Profile Picture
    creativeopinion 10,135 on at
    Re: Flow showed as failed when it was successful but extremely slow

    @ricelover_888 Instead of using an Apply to Each and Condition action you should utilize the filter query field in the Get Files (properties only) action. Looping through each file in your document library and running a condition check on each file is inefficient.

     

    Can you show a screenshot of where your flow is failing? 

     

    In the meantime, you might find this YT Tutorial helpful: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows

     

    In this Power Automate tutorial, I explore 5 frequently asked questions that pop up when troubleshooting a flow. If you’d like to to level up your Power Automate flow skills and learn how to troubleshoot your Power Automate flow—this tutorial is for you!

     

    IN THIS VIDEO:

     How to troubleshoot a false Condition action result

     How to get dynamic content when it isn’t selectable from the list of dynamic content

     How to troubleshoot an Apply to Each action that isn’t looping through

     How to troubleshoot a skipped Apply to Each action

     How to troubleshoot a Filter Query

     How to use a SharePoint yes/no column in a Filter Query

     How to use Compose actions to troubleshoot a Power Automate flow

    How to troubleshoot multiple emails being sent

     How to troubleshoot multiple Teams messages being sent

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard