cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RameshMukka
Continued Contributor
Continued Contributor

How to avoid concurrent flow runs on the same SharePoint list item in State Machine Workflows

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?

 

The solution below mentioned setting concurrency control value to 1 can avoid this situation, but it also mentions that the subsequent flows will be in queue and be triggered once the running flow is complete. I do not want that. As a record can undergo lot of changes during the state machine workflow, how can i one do this with single flow? Can someone help please

 

https://powerusers.microsoft.com/t5/General-Power-Automate/Allow-only-1-instance-of-a-flow-to-run-at... 

4 REPLIES 4
PrasadAthalye
Super User
Super User

You will have to Implement State Machine Pattern using Switch and Do until. Your currently running flow should not end. If Approver Rejects, you can send it to Submitter with Custom outcomes. If Submitter Selects Resubmit, you can again change state to start of the flow. Refer to a great Video submitted by Rezza Durrani which can be a helpful resource. 

https://www.youtube.com/watch?v=5Mypn4oCJdw

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

I did exactly what the video was shown. It was my reference while creating the flow. But what if submitter changes the list item during the flow, will the flow be trigger again? Wouldnt it be duplicate on existing flow?

tom_riha
Super User
Super User

Hello @RameshMukka ,

reading your description, I'm wondering if you really need the flow to run 'When item is modified'? If it should loop until it's approved or withdrawn, wouldn't the trigger 'When item is created' be better, to start only once after item is created? Then you wouldn't care about any updates on the item.

I quickly checked the linked video and also Rezza is using the trigger 'When item is created', ignoring item updates.

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
RameshMukka
Continued Contributor
Continued Contributor

Hi @tom_riha ,

I agree with you but am using other video of Reza where he covered flow with long running approvals. Here is the link https://www.youtube.com/watch?v=h6Eb-F0P6Hs&t=1802s. if you notice there is no loop here so we had to choose the trigger when the item is created or modified. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,886)