If you are learning Microsoft Power Apps Canvas Apps, one of the most important functions you need to understand is Patch().

At first, Patch() can look complicated because it can be used for several different operations:

  • Creating a new record
  • Updating an existing record
  • Updating multiple fields
  • Updating records based on user selections
  • Creating related records
  • Capturing the record created by Patch()
  • Working with collections
  • Working with SharePoint, Dataverse, SQL and other data sources

But the basic idea is actually very simple:

Patch is used to create or modify records in a data source.

In this tutorial, we'll learn Patch() from the ground up and gradually move toward real-world Canvas App scenarios.


1. What is Patch()?

The basic syntax of Patch() is:

Patch(
    DataSource,
    Record,
    Changes
)

Think about it as:

Where?
   ↓
Which record?
   ↓
What changes?

For example:

Patch(
    Employees,
    Defaults(Employees),
    {
        Name: "John",
        Department: "IT",
        Salary: 50000
    }
)

Here:

PartMeaning
EmployeesData source
Defaults(Employees)Create a new record
{...}Values we want to save

So this formula means:

Create a new employee record in the Employees data source.


2. Before We Start

For this tutorial, let's imagine that we have a SharePoint list called Employees.

Our list contains:

ColumnType
TitleSingle line of text
DepartmentSingle line of text
SalaryNumber
StatusChoice

For simplicity, we will use the Title column to store the employee name.

Our sample data will look like:

TitleDepartmentSalaryStatus
JohnIT50000Active
SarahHR60000Active
MikeFinance70000Active

You can use Dataverse instead of SharePoint. The concepts are largely the same, although the exact column syntax can differ depending on the column type.


3. Add the Data Source to Your Canvas App

Open your Canvas App.

Go to:

Data → Add data

Add your Employees SharePoint list.

Once connected, you should be able to reference it in Power Fx:

Employees

4. Your First Patch — Create a Record

Let's start with the simplest possible example.

Add a button to your Canvas App.

Set its OnSelect property to:

Patch(
    Employees,
    Defaults(Employees),
    {
        Title: "John",
        Department: "IT",
        Salary: 50000,
        Status: "Active"
    }
)

Click the button.

A new record will be created.

Your list should now contain something similar to:

TitleDepartmentSalaryStatus
JohnIT50000Active

5. Understanding Defaults()

The most important part of this formula is:

Defaults(Employees)

Defaults() tells Power Apps:

"I want to create a new record using the default values for this data source."

So:

Patch(
    Employees,
    Defaults(Employees),
    {...}
)

means:

Create a new record in Employees.

This is one of the most important patterns you should remember.

Create a new record

Patch(
    DataSource,
    Defaults(DataSource),
    {
        Field1: Value1,
        Field2: Value2
    }
)

6. What Happens If We Don't Use Defaults()?

Suppose you write:

Patch(
    Employees,
    {
        Title: "John"
    }
)

This isn't the normal pattern you should use when creating a new record.

For creating records, use:

Defaults(Employees)

The second argument tells Power Apps which record you want to modify.

For a new record, there isn't an existing record.

Therefore, we use Defaults().


7. Let's Make the App Interactive

Hardcoding values like:

Title: "John"

isn't very useful in a real application.

Let's create a simple Employee Registration screen.

Now change the button's OnSelect formula.

Patch(
    Employees,
    Defaults(Employees),
    {
        Title: txtName.Text,
        Department: txtDepartment.Text,
        Salary: Value(txtSalary.Text),
        Status: "Active"
    }
)

Now the values entered by the user will be stored.


8. Why Do We Use Value()?

Notice this:

Salary: Value(txtSalary.Text)

A Text Input returns text.

For example:

"50000"

But the SharePoint Salary column is a number.

Therefore, we convert the text into a number:

Value(txtSalary.Text)

So:

Title: txtName.Text

returns text.

Whereas:

Salary: Value(txtSalary.Text)

returns a number.


9. Patch Can Update Existing Records

So far, we've created records.

But Patch() can also update an existing record.

Suppose we have:

TitleDepartmentSalary
JohnIT50000
SarahHR60000
MikeFinance70000

We want to increase John's salary.

We can write:

Patch(
    Employees,
    LookUp(
        Employees,
        Title = "John"
    ),
    {
        Salary: 60000
    }
)

Let's understand it.

First:

LookUp(
    Employees,
    Title = "John"
)

finds John's record.

Then:

Patch(
    Employees,
    John's Record,
    {
        Salary: 60000
    }
)

updates that record.


10. The Difference Between Create and Update

This is one of the most important concepts.

Create

Patch(
    Employees,
    Defaults(Employees),
    {
        Title: "John",
        Salary: 50000
    }
)

Update

Patch(
    Employees,
    LookUp(
        Employees,
        Title = "John"
    ),
    {
        Salary: 60000
    }
)

The difference is the second argument.

Defaults(DataSource)
        ↓
      CREATE

Existing Record
        ↓
      UPDATE

Remember this and Patch() becomes much easier.


11. Patch Multiple Fields

You can update multiple fields in the same Patch().

For example:

Patch(
    Employees,
    LookUp(
        Employees,
        Title = "John"
    ),
    {
        Department: "Finance",
        Salary: 65000,
        Status: "Active"
    }
)

This updates three fields:

  • Department
  • Salary
  • Status

You don't need three separate Patch() statements.


12. Updating a Record Selected in a Gallery

This is where Patch() becomes extremely useful in real Canvas Apps.

Create a Gallery:

Employees

The gallery might display:

John       IT        ₹50,000
Sarah      HR        ₹60,000
Mike       Finance   ₹70,000

Add an Edit button inside the gallery.

When the user clicks Edit, we already have access to the current record through:

ThisItem

For example:

Patch(
    Employees,
    ThisItem,
    {
        Salary: 60000
    }
)

This means:

Update the record represented by the current gallery item.


13. Using a Variable to Store the Selected Record

A more realistic application would open an edit screen.

Inside the gallery:

Set(
    varSelectedEmployee,
    ThisItem
)

Then navigate to the edit screen:

Navigate(
    scrEditEmployee
)

On the edit screen, you can display:

varSelectedEmployee.Title
varSelectedEmployee.Department

and:

varSelectedEmployee.Salary

After the user modifies the information, the Save button can use:

Patch(
    Employees,
    varSelectedEmployee,
    {
        Title: txtName.Text,
        Department: txtDepartment.Text,
        Salary: Value(txtSalary.Text)
    }
)

This is a very common Canvas App pattern.


14. Patch Doesn't Require You to Update Every Column

Suppose an employee has:

Name
Department
Salary
Manager
Location
Status
Joining Date

But you only want to change the salary.

You don't need to provide every field.

You can simply write:

Patch(
    Employees,
    varSelectedEmployee,
    {
        Salary: 75000
    }
)

The other fields remain unchanged.

This is one of the biggest advantages of Patch().


15. Patch vs SubmitForm()

If you have used Edit Forms, you may have seen:

SubmitForm(Form1)

So you might ask:

Why do we need Patch()?

Both can save data, but they are useful in different situations.

SubmitForm()

Great when:

  • You're using an Edit Form
  • You want a standard form experience
  • You want Power Apps to manage the form controls and validation

Patch()

Great when:

  • You're building a custom UI
  • You want precise control over which fields are changed
  • You're saving data from multiple controls
  • You're creating related records
  • You're performing custom business logic
  • You're working with collections
  • You're doing bulk operations

A useful way to remember it:

Form-based application
        ↓
    SubmitForm()

Custom application
        ↓
      Patch()

16. Patch and Collections

Patch() isn't limited to SharePoint or Dataverse.

You can also use it with collections.

For example:

ClearCollect(
    colEmployees,
    {
        ID: 1,
        Name: "John",
        Salary: 50000
    },
    {
        ID: 2,
        Name: "Sarah",
        Salary: 60000
    }
)

Now we can update John:

Patch(
    colEmployees,
    LookUp(
        colEmployees,
        ID = 1
    ),
    {
        Salary: 55000
    }
)

The collection is updated in memory.

This is useful when building temporary data-entry experiences.


17. Patch and User Input

Let's build a small example.

Suppose we have:

Product
Quantity
Price

Controls:

txtProduct
txtQuantity
txtPrice

Button:

Patch(
    colCart,
    Defaults(colCart),
    {
        Product: txtProduct.Text,
        Quantity: Value(txtQuantity.Text),
        Price: Value(txtPrice.Text)
    }
)

Now the user can keep adding products to the collection.

For example:

ProductQuantityPrice
Laptop150000
Mouse21000
Keyboard12000

This becomes very useful later when we introduce ForAll().


18. The Return Value of Patch()

There is another powerful feature of Patch().

Patch() returns the record that it created or modified.

For example:

Set(
    varEmployee,
    Patch(
        Employees,
        Defaults(Employees),
        {
            Title: "John",
            Department: "IT",
            Salary: 50000
        }
    )
)

Now varEmployee contains the newly created record.

You can access fields from it:

varEmployee.ID
varEmployee.Title
varEmployee.Department

This is extremely useful when the data source generates values automatically.


19. Why Capturing the Created Record Is Important

Imagine we have an Expense Claim application.

The user creates:

Expense Claim
----------------
Employee: John
Date: 22-Aug-2026

After creating the claim, we need to create multiple expense details.

Conceptually:

Expense Claim
      │
      │ ID = 1001
      ↓
Expense Details
      ├── Travel
      ├── Hotel
      ├── Food
      └── Taxi

We can first create the parent record:

Set(
    varClaim,
    Patch(
        ExpenseClaims,
        Defaults(ExpenseClaims),
        {
            Employee: User().FullName,
            ClaimDate: Today()
        }
    )
)

Now:

varClaim.ID

can be used when creating the child records.

This leads directly into one of the most useful advanced combinations:

ForAll()
+
Patch()

20. Patch With ForAll()

Suppose we have:

colExpenses

Travel       2000
Hotel        4000
Food          800
Taxi          500

We want to create a record in our data source for every expense.

We can write:

ForAll(
    colExpenses,
    Patch(
        Expenses,
        Defaults(Expenses),
        {
            Category: Category,
            Amount: Amount
        }
    )
)

The logic is:

colExpenses
     ↓
ForAll()
     ↓
Take one record
     ↓
Patch()
     ↓
Take next record
     ↓
Patch()
     ↓
Continue...

This is why understanding Patch() first makes learning ForAll() much easier.


21. Patch Selected Gallery Records

Another powerful scenario is bulk updating.

Suppose your gallery contains:

☑ John       Pending
☐ Sarah      Pending
☑ Mike       Pending
☑ David      Pending

The user clicks:

Approve Selected

We can use:

ForAll(
    Filter(
        GalleryEmployees.AllItems,
        Checkbox1.Value
    ),
    Patch(
        Employees,
        ThisRecord,
        {
            Status: "Approved"
        }
    )
)

The process becomes:

Gallery
   ↓
Find selected records
   ↓
Filter()
   ↓
ForAll()
   ↓
Patch()
   ↓
Update each record

This is a pattern you will see frequently in real-world Canvas Apps.


22. Patch with SharePoint Choice Columns

If your SharePoint column is a Choice column, you need to pay attention to the expected data type.

For example, depending on the column and control, you may use:

{
    Status: {Value: "Active"}
}

rather than:

{
    Status: "Active"
}

The exact syntax can vary depending on the data source and column type, so always check the type expected by Power Apps.


23. Patch with Person Columns

SharePoint Person columns are another area where beginners often get confused.

You can't always treat a Person column like a normal text column.

For example, the Person field expects a person record rather than simply:

Manager: "John"

Instead, you typically work with a person record returned by a people-related control or connector.

The important lesson is:

Patch doesn't remove the data type requirements of your data source.

Your value must match what the target column expects.

EmployeePerson: {           
           '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",           
           Claims: "i:0#.f|membership|mayuresh@companyname.com",           
           Department: "",           
           DisplayName: "Mayuresh Joshi",           
           Email: "mayuresh@companyname.com",           
           JobTitle: "",           
           Picture: ""
        }

24. Patch and Validation

Before calling Patch(), you should validate user input.

For example:

If(
    IsBlank(txtName.Text),
    Notify(
        "Please enter employee name",
        NotificationType.Error
    ),
    Patch(
        Employees,
        Defaults(Employees),
        {
            Title: txtName.Text,
            Department: txtDepartment.Text,
            Salary: Value(txtSalary.Text)
        }
    )
)

The flow becomes:

Validate
   ↓
Is data valid?
   ↓
Yes → Patch()
   ↓
No → Show error

This is much better than blindly saving whatever the user enters.


25. Showing a Success Message

You can also show a confirmation after saving.

Patch(
    Employees,
    Defaults(Employees),
    {
        Title: txtName.Text,
        Department: txtDepartment.Text,
        Salary: Value(txtSalary.Text)
    }
);

Notify(
    "Employee saved successfully!",
    NotificationType.Success
)

The semicolon allows you to execute another formula after Patch().


26. Resetting Controls After Patch

You can also reset the input controls:

Patch(
    Employees,
    Defaults(Employees),
    {
        Title: txtName.Text,
        Department: txtDepartment.Text,
        Salary: Value(txtSalary.Text)
    }
);

Reset(txtName);
Reset(txtDepartment);
Reset(txtSalary);

Notify(
    "Employee saved successfully!",
    NotificationType.Success
)

This creates a simple data-entry experience.


27. Refreshing the Data Source

After updating a data source, you may sometimes want to refresh the local view.

For example:

Patch(
    Employees,
    Defaults(Employees),
    {
        Title: txtName.Text,
        Department: txtDepartment.Text
    }
);

Refresh(Employees)

Whether you need Refresh() depends on the scenario and how your controls are configured.


28. A Complete Employee Registration Example

Let's put everything together.

Assume we have:

txtName
txtDepartment
txtSalary
btnSave

The Save button can contain:

If(
    IsBlank(txtName.Text),
    Notify(
        "Please enter employee name",
        NotificationType.Error
    ),

    IsBlank(txtDepartment.Text),
    Notify(
        "Please enter department",
        NotificationType.Error
    ),

    IsBlank(txtSalary.Text),
    Notify(
        "Please enter salary",
        NotificationType.Error
    ),

    Patch(
        Employees,
        Defaults(Employees),
        {
            Title: txtName.Text,
            Department: txtDepartment.Text,
            Salary: Value(txtSalary.Text),
            Status: "Active"
        }
    );

    Notify(
        "Employee saved successfully!",
        NotificationType.Success
    );

    Reset(txtName);
    Reset(txtDepartment);
    Reset(txtSalary)
)

Now you have a complete mini application:

User enters information
          ↓
Validation
          ↓
Patch()
          ↓
Record created
          ↓
Success notification
          ↓
Controls reset

29. The Patch Mental Model

When you see a Patch() formula, don't try to memorize the entire formula.

Break it into three questions:

Question 1 — Where am I saving?

Employees

Question 2 — Which record am I changing?

For a new record:

Defaults(Employees)

For an existing record:

ThisItem

or:

LookUp(...)

Question 3 — What changes do I want to make?

{
    Salary: 60000,
    Status: "Active"
}

Therefore:

Patch(
    DataSource,
    Record,
    Changes
)

Once you understand these three questions, most Patch() formulas become much easier to read.


30. Common Beginner Mistakes

Mistake 1 — Forgetting Defaults()

For creating a new record, beginners often don't understand why this is needed:

Defaults(Employees)

Remember:

Defaults()
     ↓
New record

Mistake 2 — Using the wrong record

For updating an existing record, you need to identify the record correctly.

For example:

Patch(
    Employees,
    ThisItem,
    {
        Salary: 70000
    }
)

is very different from:

Patch(
    Employees,
    Defaults(Employees),
    {
        Salary: 70000
    }
)

The first updates an existing record.

The second creates a new record.


Mistake 3 — Sending text to a number column

This:

Salary: txtSalary.Text

may cause a type mismatch when the destination expects a number.

Use:

Salary: Value(txtSalary.Text)

when appropriate.


Mistake 4 — Ignoring the column type

SharePoint Choice, Person, Lookup, Date, Number and other fields have different expected structures.

Always understand your target column's data type.


31. Patch vs Collect

Beginners often confuse Patch() and Collect().

Collect()

Primarily adds records to a collection or data source.

Collect(
    colEmployees,
    {
        Name: "John"
    }
)

Patch()

Creates or modifies a record.

Patch(
    Employees,
    Defaults(Employees),
    {
        Title: "John"
    }
)

A simple way to remember:

Collect → Add records

Patch → Create or modify records

32. Patch vs UpdateIf

Another function you'll eventually encounter is:

UpdateIf()

For example:

UpdateIf(
    colEmployees,
    Department = "IT",
    {
        Status: "Active"
    }
)

UpdateIf() can be useful when you want to update records matching a condition.

Patch() is generally more explicit because you identify the record and specify the changes.

You don't need to master UpdateIf() while learning Patch(), but it's useful to know that other record-modification functions exist.


33. What You Should Practice

Before moving to ForAll(), make sure you can do these exercises without copying the answer.

Exercise 1

Create an employee using three Text Inputs.

Exercise 2

Update an employee's salary.

Exercise 3

Update two fields at the same time.

Exercise 4

Select an employee from a Gallery and update that employee.

Exercise 5

Create an employee and store the returned record in a variable.

Exercise 6

Create a collection of products and use Patch() to add products to it.

Exercise 7

Build an Expense Claim screen where the user can add multiple expense lines.

If you can complete these exercises, you're ready for the next major concept.


34. What's Next? ForAll()

Now imagine this situation.

You have:

colExpenses

Travel       ₹2,000
Hotel        ₹4,000
Food           ₹800
Taxi           ₹500

You already know how to create one record:

Patch(
    Expenses,
    Defaults(Expenses),
    {
        Category: "Travel",
        Amount: 2000
    }
)

But how do you create four records?

You could write four Patch() statements.

But that would be repetitive and wouldn't work well when the number of records changes.

This is where ForAll() becomes extremely useful.

ForAll(
    colExpenses,
    Patch(
        Expenses,
        Defaults(Expenses),
        {
            Category: Category,
            Amount: Amount
        }
    )
)

Now you have the foundation needed to understand:

ForAll() means perform an operation for every record in a table.

And because you already understand Patch(), the combination becomes much easier to understand.


Conclusion

Patch() is one of the most important functions in Power Apps Canvas Apps.

Don't try to memorize dozens of examples. Instead, remember the fundamental structure:

Patch(
    DataSource,
    Record,
    Changes
)

Then ask yourself:

  1. Which data source am I working with?

  2. Am I creating a new record or modifying an existing one?

  3. Which record am I targeting?

  4. Which fields do I want to change?

  5. Do my values match the destination column types?

Once you understand these concepts, you can use Patch() to build custom data-entry screens, edit experiences, approval applications, expense applications, shopping carts and many other Canvas Apps.

And the next logical step is ForAll(), where you'll learn how to take the same operation and apply it to multiple records.

The most important progression to remember is:

Patch one record
      ↓
Patch selected record
      ↓
Patch records from a collection
      ↓
ForAll + Patch
      ↓
Bulk data operations

That progression will take you from a beginner understanding of Patch() to patterns that are commonly used in real-world Power Apps applications.