Auto refresh data in Power Apps

When you use galleries in Power Apps to display data from a data source you will need to consider refreshing data. As the data is updated by other users you might want to auto-refresh your data. This post described a pattern for this.

Display accounts in an app

I’ve created an app that uses the Accounts entity in my CDS as a data source and Accounts are being displayed.

Gallery displaying accounts from the CDS

My app has a form to add new accounts to my database.

Adding a record to accounts using a form

This all is great when I’m the only user, however when there are multiple users you might run into some refresh issues.

As one app instance adds a new account the other users will not see this new item

The gallery is not updated

Auto-refresh data with timer

To solve this issue I’m adding a timer to my screen displaying the gallery of accounts.

Auto-refresh data with timer

On the timer you will need to set the Auto Start and Repeat and set the OnTimerStart as shown above. this will load the data in a MyData variable. Now update the Gallery to use MyData instead of the Accounts data source.

Now as one user adds a new record.

added an item

After a while you will find that the gallery in both instances synchronises. To control the refresh rate of your app you could consider some of your timer settings.

Now the gallery is updated after a while

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as a Principal Architect at HybrIT Services Ltd. You can contact me using contact@sharepains.com

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

%d bloggers like this: