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 / How to ensure data con...
Power Apps
Unanswered

How to ensure data consistency in PowerApps?

(0) ShareShare
ReportReport
Posted on by 20

When multiple users access and edit the same data, there can be conflicts between sessions, and data can be lost or changed inconsistently.
Therefore, in order to ensure data consistency what i need to do?
Please give me some solutions.


Thanks you.

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

    Hi @ChienPham ,

    Assuming two users are not accessing the same record (one saves after the other one opens it), there is no issue. It really depends on how you are saving record as to where you may have an issue overwriting fields.

  • mmollet Profile Picture
    3,187 on at

    You could essentially implement a semaphore by using an extra column in your data source but this would probably be more work than it is worth. Here is the scenario I am thinking of:

     

    Add a column to your data source called isLocked that defaults to false

    Add a rectangle to the gallery item that covers the entire item and make it clear. This is what we will use for onselect property to navigate to the edit form. Set this rectangle's display mode to the following: 

    If(ThisItem.isLocked, DisplayMode.Disabled, DisplayMode.Edit)

    When a user clicks on an item in a gallery they are navigated to either a pop up edit form or another screen with the edit form. Either way when that item is clicked in the gallery do something like the following:

    Patch(YourSPListName, ID = GalleryName.Selected.ID, {isLocked: true})

     

    This will lock that item in the gallery for all users except the first one that clicks it. You will also need to make sure you make isLocked false again during submission or canceling of the form edits.

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    @mmollet ,

    Just a thought on this - if a user exits by closing the tab, you have a heap of locked records. Another (probably a bit "clunky") method I use is to set a global Variable to the record when I open it (I do this anyway for other reasons) and then before saving test that the modified date/time on the record is the same as in the Variable when it was opened. If not, it warns the user someone has saved since they opened it and to cancel, reselect and reapply the changes. It does not happen a lot in practice and when reloaded, the user can then see the current state, which quite often has the change they were going to make.

  • mmollet Profile Picture
    3,187 on at

    Yeah you would have to open all locked records by that user when the app closes but that wouldnt even be 100% accurate as they can jsut hard close the app rather than clicking the exit button etc. This was the only idea I had off the top of my head and it reminded me of getting locked out of documents on SP and OneDrive when they are checked out by someone. Even if that person closes the file it is still checked out I believe. Def a clunky way to do it for sure! Your method makes much more sense!

     

    To be clear @ChienPham :

    store the item as an object right when the user accesses it to do their edit. This local object will store the column called Modified that SP auto-completes for you.

    UpdateContext({currentItem: Gallery.Selected etc...}) -> currentItem.Modified is now at our disposal

    Before you submit the edits do a check like so:

    If(currentItem.Modified = Gallery.Selected.Modified, [submit changes], [dont submit changes])

     

    If the modified time matches then you know it was not edited in the meantime and you are safe to submit changes. As usual Mr. Belz knows best xD

  • ChienPham Profile Picture
    20 on at

    Hey  guys, Thanks for your help. 
    But when 2 users play my app at the same time, how to refresh the current user's app, gallery when the other user adds, edits, deletes the records

  • mmollet Profile Picture
    3,187 on at

    https://www.youtube.com/watch?v=7qvO6YS9y2M

     

    check this out 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard