web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple users access ...
Power Apps
Unanswered

Multiple users access powerapp screen at the same time - Handle patch

(0) ShareShare
ReportReport
Posted on by 601

Hi All,

 

I have text input in my screen which shows number of openings available for users to register for an event. Number of openings  gets decremented by 1, when user registers successfully. 

 

Text Input Default

If(Value(glbCurrentRecord1.'No of Openings Available')>0, glbCurrentRecord1.'No of Openings Available'&" openings left","Fully Occupied")

 

Patch formula when submit button is clicked

Set(
varPatchRecord,
Patch(
'Datasource',
glbCurrentRecord1,
{'No of Openings Available': Value(glbCurrentRecord1.'No of Openings Available') - 1}
)
);

Set(
glbCurrentRecord1,
varPatchRecord
);

 

The problem now is if number of openings left is 1, and if multiple users access the powerapp screen at the same time and register for an event, both users are able to register it successfully, which should not be the case. 

 

How should I deal with this scenario? Any inputs would be helpful. 

 

NOTE: Please take note that I am not using any form. Just placed controls in the screen and patching based on button click. 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,242 Most Valuable Professional on at

    Hi @Iantaylor2050 ,

    Firstly, a fundamental flaw here is setting a Variable for a record that can "linger" in a User's App for an indeterminate amount of time and then relying on the Variable as being current. The Variable itself is a Record where the unique identifier (I have assumed you are using SharePoint here and used the ID) will always be correct, but any other values can be changed by another user between the time the record is opened and updated. I have consolidated two Variables here, but the main aim is to confirm the current state of the record immediately before it is Patched.

    With(
     {
     wRecord:
     LookUp(
     DataSource,
     ID = glbCurrentRecord1.ID
     )
     },
     Set(
     glbCurrentRecord1,
     Patch(
     'Datasource',
     {ID: glbCurrentRecord1.ID},
     {'No of Openings Available': wRecord.'No of Openings Available' - 1}
     )
     )
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 627

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard