Introduction
When building canvas apps in Power Apps, developers often get confused between Patch and UpdateIf, especially when updating records in data sources like SharePoint or Dataverse.
Although both functions are used to update data, they serve different purposes and behave differently.
This article explains the difference, syntax, best use cases, and real examples for Patch and UpdateIf—so you can choose the right function for your scenario.
What is Patch?
Patch() is a record-based function.
It is used to create, update, or merge a single record or multiple fields of a record.
Key points of Patch
Updates a specific record using its ID or record reference.
Can create a new record.
Updates only the fields you specify (partial update).
More flexible—can handle attachments, choice fields, people fields, etc.
Works great when working with forms or single-record updates.
Patch Syntax
Patch(
DataSource,
RecordToUpdate,
{
Column1: Value1,
Column2: Value2
}
)
Example of Patch
Update the Status of a specific record:
Patch(
'Expense List',
LookUp('Expense List', ID = varSelectedID),
{ Status: "Approved" }
)
Creates a new record:
Patch(
'Expense List',
Defaults('Expense List'),
{
Title: txtTitle.Text,
Amount: Value(txtAmount.Text),
Status: "Pending"
}
)
What is UpdateIf?
UpdateIf() is a condition-based function.
It updates all records that match a condition—similar to running an update query.
Key points of UpdateIf
Updates multiple records at once.
Cannot create new records.
Good for bulk updates.
Useful when the record IDs are not directly referenced.
Can update simple fields easily.
UpdateIf Syntax
UpdateIf(
DataSource,
Condition,
{
Column1: Value1,
Column2: Value2
}
)
Example of UpdateIf
Update all expenses where Status = “Pending” to “In Review”:
UpdateIf(
'Expense List',
Status = "Pending",
{ Status: "In Review" }
)
Increase Amount for all records created today:
UpdateIf(
'Expense List',
DateValue(Created) = Today(),
{ Amount: Amount + 100 }
)
Which One Should You Use?
Use Patch when:
You know the specific record (e.g., ID).
You are submitting a form.
You need to update only certain fields.
You are working with complex fields (People, Choice).
You want to create new records.
Use UpdateIf when
You need to update many records at once.
You need to update everything that matches a condition.
You are performing bulk status updates.
Conclusion
Both Patch and UpdateIf are powerful tools, but they are designed for different purposes:
Choosing the right function improves performance, maintains data integrity, and simplifies your app logic.