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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Concurrent Flow and ho...
Power Automate
Suggested Answer

Concurrent Flow and how to avoid them

(1) ShareShare
ReportReport
Posted on by 4
Hello everyone.
 
I have a power app that collects information from business users. One of the abilities they have is to add attachments (aren't they fun?). So when they submit their data, I am simply collecting and patching to a SharePoint list. However, attachments (they are special) cannot be treated by the patch command. Hence the use of a power automate flow (called from the app) that will call the record ID from the SharePoint list and place the attachments (min: 0, Max: 10 of attachments). 
 
 
But because I am running the ForAll function in my power app, the runs (if more than one attachment) execute concurrently. 
 
 
As a result - not always - to encounter failures with concurrent run trying to write to the same SharePoint record. Here is an example - a submission of 6 attachments running concurrently:
 
 
Inspecting the failed attempt shows me this:
 
 
Does anyone know how to get around this? Any additional steps? if so, where? on the power automate or power app side?
 
Sometimes it is discouraging to go through so many hoops for things that should be handled natively. But I get it. 
 
Any help would be greatly appreciated.
 
Thank you~!
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    Send them as a batch instead of 1 by 1.
     
    Then process them in your Flow as part of the array. This way you can loop through them. This shows how to pass them to power automate as a batch, then you can debatch them(by looping through the array) and pushing them to SharePoint and you wont have to worry about what you just asked, as you could do it, but you wouldn't want too as its not the best solution.
     
    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.
    Thank you!
    Sincerely, Michael Gernaey
  • Suggested answer
    Riyaz_riz11 Profile Picture
    4,150 Super User 2026 Season 1 on at
    Hi,

    Solution 1: Sequential Processing in Power Apps (Recommended)

    Replace your ForAll with a sequential loop to eliminate concurrency:

    javascript

    // Instead of ForAll, use a sequential approach
    For(attachment in AttachmentCollection,
        'Power Automate Flow'.Run(
            SharePointItemID,
            attachment.Name,
            attachment.Value
        );
        // Small delay between calls (optional)
        // Wait(100)
    );

    Solution 2: Batch Processing in Power Automate

    Modify your Power Automate flow to handle multiple attachments in a single call:

    1. Change your Power Apps call to send all attachments at once:

    javascript

    'Power Automate Flow'.Run(
        SharePointItemID,
        JSON(AttachmentCollection)
    );
    1. In Power Automate, use a "Parse JSON" action to handle the attachment array

    2. Use "Apply to each" with concurrency control:

      • In the "Apply to each" action settings

      • Turn OFF "Configure run after"

      • Set concurrency control to 1 (forces sequential processing)

    Solution 3: Power Automate Retry Logic + Delay

    Add retry logic to your existing flow:

    1. Add a "Delay" action before your "Add attachment" action:

    delay(rand(1000, 3000))  // Random delay 1-3 seconds
    1. Configure retry policy on your "Add attachment" action:

      • Click the "..." menu on the action

      • Settings → Configure run after

      • Check "has failed" and "has timed out"

      • Set retry policy: Count = 3, Interval = PT10S

    Solution 4: Queue-Based Processing (Advanced)

    For high-volume scenarios, implement a queue system:

    1. Power Apps sends all attachments to a SharePoint "Queue" list

    2. Power Automate processes queue items sequentially

    3. Use a scheduled flow that runs every few minutes to process queued items

    Code Implementation for Solution 1 (Most Practical):

    javascript

    // In your Power Apps OnSelect or OnSuccess
    ClearCollect(ProcessingResults, Blank());
    
    For(i in Sequence(CountRows(AttachmentCollection)),
        Set(CurrentAttachment, Index(AttachmentCollection, i));
        Set(FlowResult, 
            'YourPowerAutomateFlow'.Run(
                SharePointItemID,
                CurrentAttachment.Name,
                CurrentAttachment.Value
            )
        );
        Collect(ProcessingResults, FlowResult);
    );
    
    // Show completion message
    Notify("All attachments processed successfully", NotificationType.Success);

     

    If I have answered your question, please mark it as the preferred solution ✅ . If you like my response, please give it a Thumbs Up 👍.
    Regards,
    Riyaz

  • Michael E. Gernaey Profile Picture
    53,963 Moderator on at
     
    Did either solution help you resolve your problem, if so please mark one or both :-), whatever works for you

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 840

#2
Valantis Profile Picture

Valantis 661

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard