When multiple users edit data and you want your app to show real time data, you will need a multi user real time app. It isn’t a good idea to reload all your data every time someone might have updated data.

The data setup

I’m going to use SharePoint as my data store within this post, however the pattern could be applied to any database, such as SQL or Dataverse.

First of all I’m creating a list that will hold my data that is used by the app.

Create multi user real time apps in Power Apps

So my list is called Data and it has a column Title. nothing special. But you can make your list as complicated as you like.

Now when i create an app that lets me add new items to the list, I will find that items are added without any issue, however when multiple users are logged into the app, users will not see each others update until either the app is restarted or the data source is refreshed.

Create multi user real time apps in Power Apps

Now how about creating an app that actually refreshes. Well you could create a time that refreshes your data source all the time but that will not help neither the apps performance not the user experience.

Introducing the Force Refresh list

Now, I’m creating a second list that will control the refreshes. This Force Refresh list will only hold one record. You could consider adding multiple records if you have multiple data sources to control however you want to keep this list small.

Create multi user real time apps in Power Apps

So, I’ve just created a simple list again and using the out of the box Title and Modified column to do all the work. Now when I do an update to my data in my app, I will also need to update the Force Refresh list.

All I will need to do is add a second patch to my existing button code.

Patch(Data,{Title:TextInput1.Text}); 
Patch('Force Refresh', First('Force Refresh'), {Title: "Force Refresh at " & Now()});

The second patch will update the Modified date on my item that controls the refreshes.

Then within my app OnStart code I will need to read the date of the last update to my data, made my any of the updates, by any of my users.

Set(RefreshDate, Text(First('Force Refresh').Modified, DateTimeFormat.UTC));

And finally I’m going to add a timer to my app that auto starts and has repeat also set to true.

Create multi user real time apps in Power Apps

For the example I’m going to refresh the data every 1 second. I don’t like waiting. But you could of course slow this refresh down a bit.

Then in the OnTimerStart code I’m using the following lines of code to Refresh the Force Refresh (small amount of data) list every second while, I’m only refreshing the Data ( Large amount of items) when the data has changed.

multi user real time apps in Power Apps

The multi user real time app

To see this multi user real time app in action:

Now when you have multiple data source, you could consider having multiple refresh lists and timers, or you could consider having multiple items in the Force refresh list that each control the refreshes of one list.


Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe to get the latest posts sent to your email.

One thought on “Create multi user real time apps in Power Apps”
  1. Good solution! You might have to watch for conflicts if two people update the Force Refresh item at the same time.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading