I prefer to remove the standard refresh buttons from my PowerApps screens. Instead, I build automatic refresh into action states like OnVisible for screens. When a screen becomes visible, data is refreshed and my app’s users see the latest data.
Here are my two favorite methods for automatically refreshing data:
Automatic Refresh when a PowerApps Screen Becomes Visible
Adding a Refresh() function to a screen’s OnVisible property is a nifty way to have the app handle refreshing so the user automatically see the latest information.
A good practice is to use the Refresh() function on screens containing calculated values about datasource records (like the Welcome Screen from my previous Welcome Screen post and any screen displaying a gallery.
The Refresh() function is easy to use, too.
- Simply navigate to the desired screen, and select the OnVisible property for the screen. In the formula bar, type:
Swap YourDataSource with your actual data source name. Done! In just one setup step, data is refreshed when the particular screen becomes visible.
Automatic Refresh with a PowerApps Timer
My other favorite method for refreshing data automatically is by Timer control. By adding a timer to the screen and setting its duration and a few other key options, data can be refreshed in regular intervals.
- Navigate to the desired screen.
- Add a Timer control to the screen from the Insert tab in the Input group.
- Select the OnTimerEnd property for the screen. In the formula bar, type:
Swap YourDataSource with your actual data source name.
- In the Timer properties panel, toggle the Repeat and Auto start properties on.
- Toggle the Auto pause property off.
- Set the Duration to 300000. (The duration field is in milliseconds. 300000ms = 5 minutes. For your app you can decrease/increase the value but beware of refreshing too often with large datasets as it could render the app experience less pleasant.
At this point, you can test the app with the timer showing. Keep in mind you will have to wait five full minutes before refresh happens.
- Lastly, I don’t actually enjoy seeing the timer control. Toggle the Visible property off for the Timer control to hide it.