PowerApps Patch / Update

Patch is the Swiss army knife for updating data in SharePoint. You need to specify which record you wish to update. Different methods are then possible.

Patch is the Swiss army knife for updating data in SharePoint. You need to specify which record you wish to update. Different methods are then possible.

Table of contents

The basic

The easiest way to update a record is as follows

Patch(
    Books, 
    Lookup(Books, ID = 1), 
    {
        DisplayName:"Marcel Proust", 
        Information:"20th-century writer"
    }
)

In this example, we search for the recordset with ID 1 and then update the fields.
The other fields in the SharePoint list will not be updated.

How to get a recordset

We retrieve the selected line from gallery

Patch(
    Books, 
    galBooks.Selected, // Selected Line from our Gallery galBooks
    {
        DisplayName:"Voltaire", 
        Information:"Writer"
    }
)

We add a button on the lines of our gallery with the following formula in the OnSelect method

UpdateContext({bookSelected:ThisItem})

The formula is as follows

Patch(
    Books, 
    bookSelected, 
    {
        DisplayName:"Voltaire", 
        Information:"Writer"
    }
)

Patch By Id

To modify a sharepoint item by its ID, we use the Lookup function. With Lookup, we search for the record by ID

Patch(
    Books, 
    LookUp(Directory, ID =1), 
    {
        DisplayName:"Voltaire", 
        Information:"Writer"
    }
)

Share the Post:

Related Posts

PowerApps Patch Date

Patch is THE method for creating a record. It’s a magical method, because it also allows you to update information on the one hand, and target different data sources on the other.

Read More »

PowerApps Mettre à jour une date

Patch is THE method for creating a record. It’s a magical method, because it also allows you to update information on the one hand, and target different data sources on the other.

Read More »

PowerApps Patch / Add new data

Patch is THE method for creating a record. It’s a magical method, because it also allows you to update information on the one hand, and target different data sources on the other.

Read More »