cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
johnjohn123
Post Prodigy
Post Prodigy

Incrementing a Variable when multiple users are accessing the MS Flow

I have the following condition inside my MS Flow:-

 

var.png

 

where mainly i have 2 variables:-

1) TotalNumberOfUsers

2) NumberOfUsersWhoApproved

 

and as shown above i am incrementing the 2 variables by 1. but my question is let say multiple users access the condition at the exact same time, then how will MS Flow handle this? let say the variable current value =3 , and 2 users access the MS Flow at the exact same time, then can the Increment only increment the variable by 1 instead of 2 for the 2 users? or MS Flow is able to handle this situation? if not , then how i can handle this?

3 REPLIES 3
manuelstgomes
Super User
Super User

Hi @johnjohn123 

 

If this happens in concurrency, you'll have issues because:

  1. Power Automate 1 fetches the value. It's 1.
  2. Power Automate 1 starts parsing the information.
  3. Power Automate 2 fetches the value. It's 1.
  4. Power Automate 1 updates the value. 2
  5. Power Automate 2 updates the value. 2

 

Concurency in Power Automate is hard because it's connecting with the database and fetching the information at the same time.

 

The only way I see this is to have each Power Automate add a row in a list and then have another that groups the rows and updates the value. This way, you'll not deal with increments in the Power Automate, just writting to a list, and then the other Power Automate runs once to update the totals.

 

Makes sense? Is this possible?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

@manuelstgomes weird to me that power automate will not handle concurrency by default... SharePoint is document management system which should take into consideration large number of user accessing and updating the same data at the same time!!

Hi @johnjohn123 

 

SharePoint does enable multiple people collaboration but don't forget that Power Automate is request-based, so it sends a request to the source via API ou other integration and gets the results.

 

So the Power Automates need to be designed to be atomic and independent of the run of each other, otherwise you'll get into these issues.

 

It's the way it's designed. To trigger, fetch, parse and end.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,520)