cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DanielAmico
Advocate IV
Advocate IV

Allow only 1 instance of a flow to run at the same time

Hello all, I would like to know if there is a way to avoid the same flow to run while there is another instance of this same flow already running.

This is because I've noticed that when 2 or more instances of the same flow are running at the same time, the data manipulation that it's performing turns into a "complete mess". This does not happen if I wait for the running flow to complete before starting a new one. 

However, this limitation is very bad because I want to be able to share the flow w/ other people and they will eventually start it at the same time and the final result would be incorrect.

 

Basically, my flow (manually triggered) extracts some data from SQL DB (Azure), then I use an Excel template file (stored in my OneDrive for Business) w/ a table in order to be populated w/ the data from SQL. For this step, I have to first list all the rows in the table and then I loop through it and delete them all before I add the new rows that are coming from SQL.

After that, I inserted a 1-minute delay before getting the file contents /metadata and then send the excel file by email.

 

See the setup of my flow attached. 

 

I appreciate some help - as I said, what I want is to avoid this flow to be initiated at the same time because if it happens, my excel template file turns into a mess (conflicting/incorrect information is sent by email probably because one instance of the flow is inserting rows at the same time or removing rows at the same time of the other and vice versa)Setup of my flowSetup of my flow

 

 

 

Thanks, Daniel

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jcook
Most Valuable Professional
Most Valuable Professional

Hello @DanielAmico

On your trigger,
Click the 3 dots,
Now click settings.
Enable concurrency, and set it’s value to 1.

** Update - I have written a Blog on this concept **

Power Automate – Limit Runs to Trigger One at a Time – Flow Alt Delete – Josh Cook [Microsoft MVP]

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





View solution in original post

21 REPLIES 21
DanielAmico
Advocate IV
Advocate IV

Is anyone able to help? No replies until now....  Smiley Frustrated

v-xida-msft
Community Support
Community Support

Hi @DanielAmico,

 

Microsoft Flow is multi-threaded, there is no way to detect if some other instances are running at the same time in Microsoft Flow currently.

 

I afraid that there is no way to achieve your needs in Microsoft Flow currently, if you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Germinal
Frequent Visitor

Has this been solved?

I've got the exact same issue.

The main situation is unchanged, the same flow can be running at the same time if triggered. Two basic workarounds: 

 

1. Modify the trigger so that it won't be triggered multiple times in the same timeframe. For example. if the flow is on a schedule to run once every 15 minutes, then it won't run twice at the same time. 

 

2. Have something like a sharepoint list that tracks if the workflow is running. The first step of the workflow would be to retrieve a given list item and check the status field, for example. If the status empty, then set it to "running", and then proceed. If another flow instance runs at this point, it will see a status of "running" and will then simply exit. Of course, this isn't foolproof, as if the flows run at exactly the same time, they could wind up both reading the status of empty and proceed, though since this update process would happen quickly, the chances of a collision would be greatly reduced. 

Same problem here... is there a idea link to vote?

Jcook
Most Valuable Professional
Most Valuable Professional

Hello @DanielAmico

On your trigger,
Click the 3 dots,
Now click settings.
Enable concurrency, and set it’s value to 1.

** Update - I have written a Blog on this concept **

Power Automate – Limit Runs to Trigger One at a Time – Flow Alt Delete – Josh Cook [Microsoft MVP]

—Josh
If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Anonymous
Not applicable

@Jcook  thanks for this tip as it resolved an issue we were having.

Jcook
Most Valuable Professional
Most Valuable Professional

Awesome @Anonymous glad it had helped you!

 

@DanielAmico Could you please let us know if this has solved your issue. This would be even more helpful in letting others find this answer. Thanks

@v-xida-msft

 

 

 

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





I almost went ahead to implement some sort of locking mechanism to control the flow runs but your suggestion saved me a lot of time and effort. Thank you @Jcook .

Hi. Can you help clarify something?

 

Does Concurrency=1 mean one instance at a time per item, or 1 instance at a time over the whole tenant?

 

My flow is triggered when a file is added or modified (including properties) in a SharePoint library. I can't figure out (for libraries, anyway) how to leverage Trigger Conditions that rely on a particular value (the column "RunWorkflow"=True is what I usually use) because someone inevitably has the file open and I'm unable to turn that condition OFF, so any subsequent changes to the file re-trigger it.

 

I just want to prevent the workflow from running AGAIN (in parallel) on the SAME ITEM.

Jcook
Most Valuable Professional
Most Valuable Professional

Hi @mboonie 

 

Setting the Concurrency to 1 will only affect that particular Flow. This will not affect Tenant / other Flows in any way.

 

Setting to 1 will only allow the Flow to run 1 at a time. So there is 0 parallel runs. A second run will not be triggered until the previous run has finished. 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Actually, it still doesn't quite answer my particular question. I'll try to explain using a very stripped down version of my flow.

I have a flow called myFlow; it is triggered by adding or editing a document in the Documents library for my Team site. It takes three days to run because it allows 1 day for each of three edits that need to be made. Also, because additional edits are expected to be made to that same document as the flow is running, I need to have a way to stop the flow from being re-triggered for that item; it needs to run its course.

So, now I set the concurrency of the workflow itself to 1 and add a document to the library. The workflow myFlow is kicked off and the three-day clock starts ticking. And, since this is a busy library, someone creates and edits a second document in the same library on the same day, an hour later

The question I have is this: Will I have to wait three days for the workflow to finish with Document 1 before it will start on Document 2?

 

Jcook
Most Valuable Professional
Most Valuable Professional

@mboonie 


@mboonie wrote:

The question I have is this: Will I have to wait three days for the workflow to finish with Document 1 before it will start on Document 2?

 


Yes the Flow would wait until the first Run has finished. So for your use case/solution I would say Concurrency set to 1 would not be beneficial.

 

I suggest that you create a new post detailing what you have mentioned above. This will help others find your issue and try to help solve. 🙂 

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





@Jcook, thanks a lot, I think that should work but can we clarify something; as 1 occurrence of the flow is running at a time, do the new trigger actions queue up to start a new occurrence of the flow (when occurrence is set to 1)? I mean if several actions triggering the flow are filled in more or less at the same time, does the flow run them one after one in a chronological queue? Or are the next actions ignored/forgotten?

BW

@Germinal,

 

I have tried concurrency set to 1 with a CDS trigger and the flow runs are queued and in waiting status from what i have observed.

 

@Jcook, correct me if i am wrong.

Anonymous
Not applicable

@Jcook 

 

Hi,

 

Will this "hold" the flow to run after first has finished or does it just not allow flow to start?

 

IE I have a flow triggered by emails, these come in from all over, I would like them to queue up.

 

Ta

 

Mark

RameshMukka
Impactful Individual
Impactful Individual

I have a State Machine Flow on a SharePoint list which goes with 4 different approvers. Any time an approver rejects it, the flow goes back to requestor with custom approval actions "Submit for Approval" and "Withdraw". Here the requestor can make changes to the list item and "Submit for Approval" again. I dont want any flow to be triggered again here. I am already using a flag (StartWF text column) to decide whether to run the flow or not during the flow run. During this entire process, if my List item which is under approval process is modified, my flow is triggered again causing parallel runs which is a great confusion. How should I avoid this? Does Concurrency control setting help me here? I dont want flows to be queued for a given item while a flow is already running on that item.
Anonymous
Not applicable

Hi Josh,

 

I tried to implement your solution but I get an error in my flow. The first instance works fine, but the subsequent flows fail. I get the below error when I am trying to create a file in SharePoint: 

{"statusCode":400,"headers":{"Vary":"Origin","X-SharePointHealthScore":"3","X-MS-SPConnector":"1","X-SP-SERVERSTATE":"ReadOnly=0","DATASERVICEVERSION":"3.0","SPClientServiceRequestDuration":"64","SPRequestGuid":"5b5735a9-cf16-4f77-8359-f2a8e819caae","request-id":"5b5735a9-cf16-4f77-8359-f2a8e819caae","MS-CV":"qTVXWxbPd0+DWfKo6BnKrg.0","Strict-Transport-Security":"max-age=31536000","X-FRAME-OPTIONS":"SAMEORIGIN","Content-Security-Policy":"frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com;","MicrosoftSharePointTeamServices":"16.0.0.21402","X-Content-Type-Options":"nosniff","X-MS-InvokeApp":"1; RequireReadOnly","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"max-age=0, private","Date":"Thu, 17 Jun 2021 09:27:14 GMT","P3P":"CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Content-Length":"376","Content-Type":"application/json","Expires":"Wed, 02 Jun 2021 09:27:14 GMT","Last-Modified":"Thu, 17 Jun 2021 09:27:14 GMT"},"body":{"status":400,"message":"A file with the name Shared Documents/Solution Testing/CreatedDocs/New file b6706584-9279-4ab6-afff-e45885d78434 already exists. It was last modified by i:0#.f|membership|XXXXXXX on 17 Jun 2021 02:27:07 -0700.\r\nclientRequestId: 5b5735a9-cf16-4f77-8359-f2a8e819caae\r\nserviceRequestId: 5b5735a9-cf16-4f77-8359-f2a8e819caae"}}

Before I tried using the concurrent suggestion the flows used to run simulaneously and I got the below error:

{"statusCode":400,"headers":{"Vary":"Origin","X-SharePointHealthScore":"2","X-MS-SPConnector":"1","X-SP-SERVERSTATE":"ReadOnly=0","DATASERVICEVERSION":"3.0","SPClientServiceRequestDuration":"58","SPRequestGuid":"413e8b7e-25f0-4f24-81ef-1fd5e886ed4d","request-id":"413e8b7e-25f0-4f24-81ef-1fd5e886ed4d","MS-CV":"fos+QfAlJE+B7x/V6IbtTQ.0","Strict-Transport-Security":"max-age=31536000","X-FRAME-OPTIONS":"SAMEORIGIN","Content-Security-Policy":"frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com;","MicrosoftSharePointTeamServices":"16.0.0.21402","X-Content-Type-Options":"nosniff","X-MS-InvokeApp":"1; RequireReadOnly","Timing-Allow-Origin":"*","x-ms-apihub-cached-response":"true","Cache-Control":"max-age=0, private","Date":"Wed, 16 Jun 2021 09:08:41 GMT","P3P":"CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\"","X-AspNet-Version":"4.0.30319","X-Powered-By":"ASP.NET","Content-Length":"179","Content-Type":"application/json","Expires":"Tue, 01 Jun 2021 09:08:41 GMT","Last-Modified":"Wed, 16 Jun 2021 09:08:41 GMT"},"body":{"status":400,"message":"Error in the application.\r\nclientRequestId: 413e8b7e-25f0-4f24-81ef-1fd5e886ed4d\r\nserviceRequestId: 413e8b7e-25f0-4f24-81ef-1fd5e886ed4d"}}

 This is what my flow looks like. It is failing at the create file part of the apply to each. The flow works correctly for the first run, then fails for the other consecutive flows when the trigger is initiated at the same time/a short time apart from each other. If I leave 15 seconds between triggers it always runs correctly so I am not sure what is going wrong.

 

This is using the concurrent technique set to 1:

 

freddiejoseph1_0-1623924683890.png

 

If I manually leave 15 seconds between triggering the flow it works just fine:

 

freddiejoseph1_1-1623924743202.png

 

 

Any suggestions? I have asked the question here: https://powerusers.microsoft.com/t5/Building-Flows/Flow-fails-when-triggered-multiple-times-in-a-sho... but no one has come back to me.

 

Thanks,

 

Freddie

 

 

Nata123
New Member

Hi everyone

 

I  set my workflow to run only one instance at a time. And it works fine, except that not all flow instances have been executed. 

I created 130 instances in dataverse table, and for each instance on creation starts a workflow. The problem is that 2 days later I am still missing about 50 workflow instances to be executed. Any clue how I can see the status of missing workflow  instances? They are nor failed or in progress, they are just not there. Last run was 19 hours ago.

 

Thanks in advance!

Helpful resources

Announcements

Calling all User Group Leaders and Super Users! Mark Your Calendars for the next Community Ambassador Call on May 9th!

This month's Community Ambassador call is on May 9th at 9a & 3p PDT. Please keep an eye out in your private messages and Teams channels for your invitation. There are lots of exciting updates coming to the Community, and we have some exclusive opportunities to share with you! As always, we'll also review regular updates for User Groups, Super Users, and share general information about what's going on in the Community.     Be sure to register & we hope to see all of you there!

April 2024 Community Newsletter

We're pleased to share the April Community Newsletter, where we highlight the latest news, product releases, upcoming events, and the amazing work of our outstanding Community members.   If you're new to the Community, please make sure to follow the latest News & Announcements and check out the Community on LinkedIn as well! It's the best way to stay up-to-date with all the news from across Microsoft Power Platform and beyond.    COMMUNITY HIGHLIGHTS   Check out the most active community members of the last month! These hardworking members are posting regularly, answering questions, kudos, and providing top solutions in their communities. We are so thankful for each of you--keep up the great work! If you hope to see your name here next month, follow these awesome community members to see what they do!   Power AppsPower AutomateCopilot StudioPower PagesWarrenBelzDeenujialexander2523ragavanrajanLaurensMManishSolankiMattJimisonLucas001AmikcapuanodanilostephenrobertOliverRodriguestimlAndrewJManikandanSFubarmmbr1606VishnuReddy1997theMacResolutionsVishalJhaveriVictorIvanidzejsrandhawahagrua33ikExpiscornovusFGuerrero1PowerAddictgulshankhuranaANBExpiscornovusprathyooSpongYeNived_Nambiardeeksha15795apangelesGochixgrantjenkinsvasu24Mfon   LATEST NEWS   Business Applications Launch Event - On Demand In case you missed the Business Applications Launch Event, you can now catch up on all the announcements and watch the entire event on-demand inside Charles Lamanna's latest cloud blog.   This is your one stop shop for all the latest Copilot features across Power Platform and #Dynamics365, including first-hand looks at how companies such as Lenovo, Sonepar, Ford Motor Company, Omnicom and more are using these new capabilities in transformative ways. Click the image below to watch today!   Power Platform Community Conference 2024 is here! It's time to look forward to the next installment of the Power Platform Community Conference, which takes place this year on 18-20th September 2024 at the MGM Grand in Las Vegas!   Come and be inspired by Microsoft senior thought leaders and the engineers behind the #PowerPlatform, with Charles Lamanna, Sangya Singh, Ryan Cunningham, Kim Manis, Nirav Shah, Omar Aftab and Leon Welicki already confirmed to speak. You'll also be able to learn from industry experts and Microsoft MVPs who are dedicated to bridging the gap between humanity and technology. These include the likes of Lisa Crosbie, Victor Dantas, Kristine Kolodziejski, David Yack, Daniel Christian, Miguel Félix, and Mats Necker, with many more to be announced over the coming weeks.   Click here to watch our brand-new sizzle reel for #PPCC24 or click the image below to find out more about registration. See you in Vegas!       Power Up Program Announces New Video-Based Learning Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram. These include 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 image below to find out more!   UPCOMING EVENTS Microsoft Build - Seattle and Online - 21-23rd May 2024 Taking place on 21-23rd May 2024 both online and in Seattle, this is the perfect event to learn more about low code development, creating copilots, cloud platforms, and so much more to help you unleash the power of AI.   There's a serious wealth of talent speaking across the three days, including the likes of Satya Nadella, Amanda K. Silver, Scott Guthrie, Sarah Bird, Charles Lamanna, Miti J., Kevin Scott, Asha Sharma, Rajesh Jha, Arun Ulag, Clay Wesener, and many more.   And don't worry if you can't make it to Seattle, the event will be online and totally free to join. Click the image below to register for #MSBuild today!   European Collab Summit - Germany - 14-16th May 2024 The clock is counting down to the amazing European Collaboration Summit, which takes place in Germany May 14-16, 2024. #CollabSummit2024 is designed to provide cutting-edge insights and best practices into Power Platform, Microsoft 365, Teams, Viva, and so much more. There's a whole host of experts speakers across the three-day event, including the likes of Vesa Juvonen, Laurie Pottmeyer, Dan Holme, Mark Kashman, Dona Sarkar, Gavin Barron, Emily Mancini, Martina Grom, Ahmad Najjar, Liz Sundet, Nikki Chapple, Sara Fennah, Seb Matthews, Tobias Martin, Zoe Wilson, Fabian Williams, and many more.   Click the image below to find out more about #ECS2024 and register today!     Microsoft 365 & Power Platform Conference - Seattle - 3-7th June If you're looking to turbo boost your Power Platform skills this year, why not take a look at everything TechCon365 has to offer at the Seattle Convention Center on June 3-7, 2024.   This amazing 3-day conference (with 2 optional days of workshops) offers over 130 sessions across multiple tracks, alongside 25 workshops presented by Power Platform, Microsoft 365, Microsoft Teams, Viva, Azure, Copilot and AI experts. There's a great array of speakers, including the likes of Nirav Shah, Naomi Moneypenny, Jason Himmelstein, Heather Cook, Karuana Gatimu, Mark Kashman, Michelle Gilbert, Taiki Y., Kristi K., Nate Chamberlain, Julie Koesmarno, Daniel Glenn, Sarah Haase, Marc Windle, Amit Vasu, Joanne C Klein, Agnes Molnar, and many more.   Click the image below for more #Techcon365 intel and register today!     For more events, click the image below to visit the Microsoft Community Days website.      

Tuesday Tip | Update Your Community Profile Today!

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.   We're excited to announce that updating your community profile has never been easier! Keeping your profile up to date is essential for staying connected and engaged with the community.   Check out the following Support Articles with these topics: Accessing Your Community ProfileRetrieving Your Profile URLUpdating Your Community Profile Time ZoneChanging Your Community Profile Picture (Avatar)Setting Your Date Display Preferences Click on your community link for more information: Power Apps, Power Automate, Power Pages, Copilot Studio   Thank you for being an active part of our community. Your contributions make a difference! Best Regards, The Community Management 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  

Super User of the Month | Ahmed Salih

We're thrilled to announce that Ahmed Salih is our Super User of the Month for April 2024. Ahmed has been one of our most active Super Users this year--in fact, he kicked off the year in our Community with this great video reminder of why being a Super User has been so important to him!   Ahmed is the Senior Power Platform Architect at Saint Jude's Children's Research Hospital in Memphis. He's been a Super User for two seasons and is also a Microsoft MVP! He's celebrating his 3rd year being active in the Community--and he's received more than 500 kudos while authoring nearly 300 solutions. Ahmed's contributions to the Super User in Training program has been invaluable, with his most recent session with SUIT highlighting an incredible amount of best practices and tips that have helped him achieve his success.   Ahmed's infectious enthusiasm and boundless energy are a key reason why so many Community members appreciate how he brings his personality--and expertise--to every interaction. With all the solutions he provides, his willingness to help the Community learn more about Power Platform, and his sheer joy in life, we are pleased to celebrate Ahmed and all his contributions! You can find him in the Community and on LinkedIn. Congratulations, Ahmed--thank you for being a SUPER user!

Tuesday Tip: Getting Started with Private Messages & Macros

Welcome to 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!   This Week's Tip: Private Messaging & Macros in Power Apps Community   Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member!   Our Knowledge Base article about private messaging and macros is the best place to find out more. Check it out today and discover some key tips and tricks when it comes to messages and macros:   Private Messaging: Learn how to enable private messages in your community profile and ensure you’re connected with other community membersMacros Explained: Discover the convenience of macros—prewritten text snippets that save time when posting in forums or sending private messagesCreating Macros: Follow simple steps to create your own macros for efficient communication within the Power Apps CommunityUsage Guide: Understand how to apply macros in posts and private messages, enhancing your interaction with the Community For detailed instructions and more information, visit the full page in your community today:Power Apps: Enabling Private Messaging & How to Use Macros (Power Apps)Power Automate: Enabling Private Messaging & How to Use Macros (Power Automate)  Copilot Studio: Enabling Private Messaging &How to Use Macros (Copilot Studio) Power Pages: Enabling Private Messaging & How to Use Macros (Power Pages)

Users online (3,927)