Get latest copy or refresh a record from datasource in Power Apps canvas apps

Looking at the title of this post, you might be wondering – Isn’t it pretty easy? After all we have the Refresh function in Power Apps which refreshes an entire datasource.

However, there are situations where you want to refresh a single record from a datasource. Suppose you are working on a form for sometime and you want to make sure you work on a fresh copy of the record before you make changes and save it back to the datasource.

How do I do that? I don’t want to refresh the whole datasource here. But a single record of the datasource. Here is comes the utility of the Revert function.

Let’s take an example here. Below is a Gallery of Contacts. From the Gallery when I select a contact, it show up on the form beside the gallery.

Get latest copy of record from data source in Power Apps Canvas apps.

No complexity here. However say you want to get a fresh copy of the record from the data source.

And below is the code you need to get a fresh copy of the record from the datasource.

Revert(
    Contacts,
    LookUp(
        Contacts,
        'Contact (contactid)' = Gallery1.Selected.'Contact (contactid)'
    )
)

Infact, Revert can be used to just refresh the data source as well. Revert however do have other functionalities like “Revert also clears any errors from the table that the Errors function returned.

Hope this helped!

You might also like the below posts

Debajit Dutta
Business Solutions MVP