cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User III
Super User III

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

17 REPLIES 17
Advocate IV
Advocate IV

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

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.
Frequent Visitor

Has this been solved?

I've got the exact same issue.

Continued Contributor
Continued Contributor

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?

Super User III
Super User III

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

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

Awesome @shanemeisner 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.

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?

 

@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.

@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

Post Patron
Post Patron

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.

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (35,726)