top of page

Let's Master on Data Manipulation: A Deep Dive into the Canvas App Patch Function

Updated: Oct 7, 2023

The Patch function is commonly used to create new records or update existing records in a data source

It can also be used to merge two or more records.

Bulk operation can also be done using it.

It's particularly useful when:

  • You want more control over which fields are updated and how data is transformed before updating.

  • You need to update multiple data sources in a single action.

  • You want to update or create records based on conditions, calculations, or complex logic.

Basic Syntax


Syntax to Create Record:


In this example, the Defaults function creates a new record with default values, and the Patch function fills in the specified field values.

Default with Patch Function

Default Function:

This function returns a record that contains the default values for the data source. If a column within the data source doesn't have a default value, that property won't be present.

You can combine the Defaults function with the Patch function to create a record.

Syntax: Defaults(DataSource)

Modify / Update using Patch Function

Syntax to Update Record:


In this example, the LookUp function is used to locate the employee with ID "123," and the Patch function updates the "Salary" field to 60000.

Merge using Patch Function

Syntax to Merge 2 Record:


It will not create/update record in data source, it will juts combine the records with later values overriding the earlier ones.

Bulk Operation using Patch Function

Modify or create a set of records in a data source

Patch can also be used to create or modify multiple records with a single call.

Instead of passing a single base record, a table of base records can be provided in the second argument. Change records are provided in a table as well, corresponding one-for-one with the base records. The number of records in each change table must be the same as the number of records in the base table.

When using Patch in this manner, the return value is also a table with each record corresponding one-for-one with the base and change records.


Error Handling

When you update a data source, one or more issues may arise. Use IfError and IsError with the return value from Patch to detect and respond to errors. You can also use the Errors function to identify and examine issues,


The IfError function tests values until it finds an error. If the function discovers an error, the function evaluates and returns a corresponding replacement value and stops further evaluation.



The IsError function tests for an error value.

The return value is a Boolean true or false.

Using IsError will prevent any further processing of the error.


It will return true in the result.


Use the Error function to create and report a custom error.


NOTE: The Patch function is a fundamental tool for working with data in Canvas Apps, and understanding its capabilities is essential for effective app development.


How do I use the Patch function to update records?

Can I use the Patch function to create new records?

Can I use the Patch function with multiple records at once?

What happens if there's an error while patching data?

Does the Patch function support complex data sources like SharePoint lists or SQL databases?

Are there any limitations or considerations when using the Patch function?

Can I use the Patch function in offline mode?


bottom of page