Power Apps Patch function with SharePoint

Patch function – modify or create one or more records in a data source

Patch Syntax

Create record in data source

Patch(DataSource, Defaults(DataSource), {Record}

Update record in data soure

Patch(DataSource, Item, {Record})


SharePoint Columns Patch syntax

Choice Column

{Value: "choice value"}

Person Column

{
  Claims: Concatenate(
          "i:0#.f|membership|",
          User().Email // Person email
          ),
          Department: "",
          DisplayName: User().FullName,
          Email: User().Email, // Person email
          JobTitle: "",
          Picture: ""
}

Lookup column

{
     Value: "val 1", // Value of lookup column
     Id: 2 // Id of lookup column
}

Multi Select Choice column

Table(
{Value: "choice value 1"},
{Value: "choice value 2"} // keep adding multiple choices
)

*Can also use a collection to patch the choice column

ClearCollect(colChoices,{Value: "choice value 1"}, {Value: "choice value 2"})

or

Get data to patch from a combo box. Load the combo box directly from the choice column of SharePoint using

Choices(DataSource.ColumnName)

Multi Select Lookup column

Table(    
      {
         Value: "val 1", // Value of lookup column
         Id: 1 // Id of lookup column
      },        
      {
         Value: "val 2", // Value of lookup column
         Id: 2 // Id of lookup column
      }  // keep adding multiple lookup values
   )

*Can also use a collection to patch the lookup column

 ClearCollect(colLookupValues,{Value: "val 1",Id:1}, {Value: "val 2",Id:2}) 

or

Get data to patch from a combo box. Load the combo box directly from the lookup column of SharePoint using

Choices(DataSource.ColumnName) 

Yes/No column

 1  // Yes value. For No value use false

Managed Metadata column

{
Label: "label",
Path: "",
TermGuid: "d30784d3-f4dc-46e2-b3ed-577b9ae5bea9",// Replace with term guid
Value: "",
WssId: 0
}

2 Replies to “Power Apps Patch function with SharePoint”

  1. As usual, awesome video. You explain things very clearly. This was confusing to me but you made it simple. Thank you, Reza.

Comments are closed.