Skip to main content

How to Refresh Data in Power Apps with the Refresh Function

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

Refresh gets a fresh copy of a data source, so the app shows changes other people made while it was running. It has no result, and it only works in formulas that run on an action, such as OnSelect and OnVisible. If your screen keeps data in variables, run its queries again after Refresh.

Syntax​

Syntax
Refresh(DataSource)
  • DataSource is the data source to refresh, such as a SharePoint list in your app.
  • Refresh has no return value. Microsoft's reference says you can use it only in behavior formulas (Refresh function).

When You Need It​

Microsoft documents when an app has fresh data and when it doesn't:

Your own app's changes are different. After a Patch in the Career Development Plan app, going back to the list showed the new status at once, without Refresh (Part 6). You need Refresh for other people's changes.

Example: The Status That Didn't Change​

In the Career Development Plan app, an employee's My plan screen lists her competencies with a status each. Her manager approved one in another browser. Opening My plan again still showed Waiting for review, even minutes later (Fixed: Power Apps Doesn't Show Changes Other People Made).

The fix starts the screen's loading formula with Refresh on both lists it reads, and a Refresh button in the header runs the same formula (How to Add a Refresh Button to a Screen). The start of that formula:

btnRefreshMPS → OnSelect (start)
UpdateContext({locIsLoading: true});
Refresh(RoleCompetencies);
Refresh(CompetencyResponses);

Here's the screen before a refresh, with Leadership still Waiting for review after the manager approved it:

The My plan screen with a Refresh button in the header, Leadership showing Waiting for review, Sales strategy Approved and Stakeholder management Not started

And after selecting Refresh:

The same screen after Refresh, with Leadership now showing Approved

Refresh Updates the Data Source, Not Your Variables​

Microsoft's example shows galleries bound to the data source updating after Refresh. A variable is different: UpdateContext, Set and collections hold a copy of the result, made when the formula ran (Delegation and collections). Refresh doesn't change that copy.

So in a screen that loads its data into variables, call Refresh first and then run the queries again:

Order
Refresh(CompetencyResponses);
UpdateContext(
{
locMyResponses: Filter(
CompetencyResponses,
EmployeeId = MyProfile.id
)
}
)

Where to Call It​

  • At the start of a screen's loading formula, so the screen shows current data every time it opens.
  • In a Refresh button, for people who stay on a screen and want the latest data.

In the example, both run one formula: it lives in the button's OnSelect, and the screen's OnVisible selects the button.

Common Mistakes​

MistakeWhat happensDo this instead
Calling Refresh and nothing else on a screen that uses variablesThe screen still shows its old copyRun the screen's queries again after Refresh
Using Refresh in a property such as Text or ItemsNot allowed: it only works in behavior formulasCall it in OnVisible or OnSelect
Testing changes with one accountYour own changes always showTest with a second person in another browser

Troubleshooting​

SymptomLikely causeFix
Changes made in SharePoint don't appearThe app doesn't detect outside changes while runningRefresh the list
Refresh runs but a gallery stays the sameThe gallery shows a variableLoad the variable again after Refresh
A save fails because the item changedThe app's copy is older than SharePoint'sRead the item again, then save (Fixed: ETAG Mismatch)

FAQ​

What's the difference between Refresh and Revert?​

Both get fresh data. Microsoft's reference says Revert can also refresh a single record, and it clears the errors that the Errors function reports for it (Revert function).

Does Refresh reload my whole SharePoint list into the app?​

Microsoft's reference describes it as a fresh copy of the data source and doesn't go further. Your queries decide what the app loads: delegable queries still run in SharePoint.

Conclusion​

Refresh(DataSource) is how a running canvas app sees other people's changes. Call it at the start of a screen's loading formula and in a Refresh button, and if the screen uses variables, load them again after it.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.