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

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT).     This is an incredible opportunity to connect with members of the Copilot Studio product team and ask them anything about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendars now because you will not want to miss the conversation.   This live event will give you the unique opportunity to learn more about Copilot Studio plans, where we’ll focus, and get insight into upcoming features. We’re looking forward to hearing from the community, so bring your questions!   TO GET ACCESS TO THIS EXCLUSIVE AMA: Kudo this post to reserve your spot! Reserve your spot now by kudoing this post.  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today.   Invitations will be sent on April 2nd.Users posting Kudos after April 2nd at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendars for April 3, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Unlocking Community Achievements and Earning Badges

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!     THIS WEEK'S TIP: Unlocking Achievements and Earning BadgesAcross the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. These badges each signify a different achievement--and all of those achievements are available to any Community member! If you're a seasoned pro or just getting started, you too can earn badges for the great work you do. Check out some details on Community badges below--and find out more in the detailed link at the end of the article!       A Diverse Range of Badges to Collect The badges you can earn in the Community cover a wide array of activities, including: Kudos Received: Acknowledges the number of times a user’s post has been appreciated with a “Kudo.”Kudos Given: Highlights the user’s generosity in recognizing others’ contributions.Topics Created: Tracks the number of discussions initiated by a user.Solutions Provided: Celebrates the instances where a user’s response is marked as the correct solution.Reply: Counts the number of times a user has engaged with community discussions.Blog Contributor: Honors those who contribute valuable content and are invited to write for the community blog.       A Community Evolving Together Badges are not only a great way to recognize outstanding contributions of our amazing Community members--they are also a way to continue fostering a collaborative and supportive environment. As you continue to share your knowledge and assist each other these badges serve as a visual representation of your valuable contributions.   Find out more about badges in these Community Support pages in each Community: All About Community Badges - Power Apps CommunityAll About Community Badges - Power Automate CommunityAll About Community Badges - Copilot Studio CommunityAll About Community Badges - Power Pages Community

Tuesday Tips: Powering Up Your Community Profile

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week's Tip: Power Up Your Profile!  🚀 It's where every Community member gets their start, and it's essential that you keep it updated! Your Community User Profile is how you're able to get messages, post solutions, ask questions--and as you rank up, it's where your badges will appear and how you'll be known when you start blogging in the Community Blog. Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile.     Password Puzzles? No Problem! Find out how to sync your Azure AD password with your community account, ensuring a seamless sign-in. No separate passwords to remember! Job Jumps & Email Swaps Changed jobs? Got a new email? Fear not! You'll find out how to link your shiny new email to your existing community account, keeping your contributions and connections intact. Username Uncertainties Unraveled Picking the perfect username is crucial--and sometimes the original choice you signed up with doesn't fit as well as you may have thought. There's a quick way to request an update here--but remember, your username is your community identity, so choose wisely. "Need Admin Approval" Warning Window? If you see this error message while using the community, don't worry. A simple process will help you get where you need to go. If you still need assistance, find out how to contact your Community Support team. Whatever you're looking for, when it comes to your profile, the Community Account Support Knowledge Base article is your treasure trove of tips as you navigate the nuances of your Community Profile. It’s the ultimate resource for keeping your digital identity in tip-top shape while engaging with the Power Platform Community. So, dive in and power up your profile today!  💪🚀   Community Account Support | Power Apps Community Account Support | Power AutomateCommunity Account Support | Copilot Studio  Community Account Support | Power Pages

Super User of the Month | Chris Piasecki

In our 2nd installment of this new ongoing feature in the Community, we're thrilled to announce that Chris Piasecki is our Super User of the Month for March 2024. If you've been in the Community for a while, we're sure you've seen a comment or marked one of Chris' helpful tips as a solution--he's been a Super User for SEVEN consecutive seasons!   Since authoring his first reply in April 2020 to his most recent achievement organizing the Canadian Power Platform Summit this month, Chris has helped countless Community members with his insights and expertise. In addition to being a Super User, Chris is also a User Group leader, Microsoft MVP, and a featured speaker at the Microsoft Power Platform Conference. His contributions to the new SUIT program, along with his joyous personality and willingness to jump in and help so many members has made Chris a fixture in the Power Platform Community.   When Chris isn't authoring solutions or organizing events, he's actively leading Piasecki Consulting, specializing in solution architecture, integration, DevOps, and more--helping clients discover how to strategize and implement Microsoft's technology platforms. We are grateful for Chris' insightful help in the Community and look forward to even more amazing milestones as he continues to assist so many with his great tips, solutions--always with a smile and a great sense of humor.You can find Chris in the Community and on LinkedIn. Thanks for being such a SUPER user, Chris! 💪 🌠  

Find Out What Makes Super Users So Super

We know many of you visit the Power Platform Communities to ask questions and receive answers. But do you know that many of our best answers and solutions come from Community members who are super active, helping anyone who needs a little help getting unstuck with Business Applications products? We call these dedicated Community members Super Users because they are the real heroes in the Community, willing to jump in whenever they can to help! Maybe you've encountered them yourself and they've solved some of your biggest questions. Have you ever wondered, "Why?"We interviewed several of our Super Users to understand what drives them to help in the Community--and discover the difference it has made in their lives as well! Take a look in our gallery today: What Motivates a Super User? - Power Platform Community (microsoft.com)

March User Group Update: New Groups and Upcoming Events!

  Welcome to this month’s celebration of our Community User Groups and exciting User Group events. We’re thrilled to introduce some brand-new user groups that have recently joined our vibrant community. Plus, we’ve got a lineup of engaging events you won’t want to miss. Let’s jump right in: New User Groups   Sacramento Power Platform GroupANZ Power Platform COE User GroupPower Platform MongoliaPower Platform User Group OmanPower Platform User Group Delta StateMid Michigan Power Platform Upcoming Events  DUG4MFG - Quarterly Meetup - Microsoft Demand PlanningDate: 19 Mar 2024 | 10:30 AM to 12:30 PM Central America Standard TimeDescription: Dive into the world of manufacturing with a focus on Demand Planning. Learn from industry experts and share your insights. Dynamics User Group HoustonDate: 07 Mar 2024 | 11:00 AM to 01:00 PM Central America Standard TimeDescription: Houston, get ready for an immersive session on Dynamics 365 and the Power Platform. Connect with fellow professionals and expand your knowledge. Reading Dynamics 365 & Power Platform User Group (Q1)Date: 05 Mar 2024 | 06:00 PM to 09:00 PM GMT Standard TimeDescription: Join our virtual meetup for insightful discussions, demos, and community updates. Let’s kick off Q1 with a bang! Leaders, Create Your Events!  Leaders of existing User Groups, don’t forget to create your events within the Community platform. By doing so, you’ll enable us to share them in future posts and newsletters. Let’s spread the word and make these gatherings even more impactful! Stay tuned for more updates, inspiring stories, and collaborative opportunities from and for our Community User Groups.   P.S. Have an event or success story to share? Reach out to us – we’d love to feature you!

Users online (6,342)