Mastering the Power Apps Patch Function

If you’ve ever needed to create or change records directly in a data source like SharePoint or Dataverse without using a full form, the Power Apps Patch function is the tool you’re looking for. It’s less like a sledgehammer and more like a scalpel, giving you precise control over your data. According to Forrester, low-code platforms like Power Apps can reduce app development time by up to 90%, and mastering functions like Patch
is key to realizing those efficiency gains.
Getting to Know the Power Apps Patch Function
At its heart, the Patch function is what lets you save and manipulate individual pieces of data in your apps. While the SubmitForm
function is great for handling, well, entire forms, Patch gives you pinpoint accuracy. You can target specific records and fields, which is exactly what you need for building fast, dynamic apps.
Think about an inventory management app. A user on the warehouse floor could tap a single button to increase a product’s stock count by one. That’s a perfect job for Patch—it’s clean, efficient, and happens instantly without a full form submission.
As Power Apps continues to evolve with new features and AI integrations, mastering core functions like Patch becomes even more critical. Having this fundamental skill in your back pocket is essential for any serious app builder.

Why Patch Is So Useful in the Real World
The real magic of the Patch function is its flexibility. It’s not just for basic data entry; it opens the door to creating much more sophisticated and intuitive user experiences. When you streamline data operations this way, the efficiency gains can be huge. In some workflows I’ve built, apps that allow for quick, in-place record updates have cut task completion time by over 50%.
Here are a few common scenarios where I find myself reaching for Patch almost every time:
- Quick Status Updates: Imagine a project management app. You can let users change a task’s status from “In Progress” to “Completed” with a single click inside a gallery, without ever leaving the main screen.
- Live Inventory Control: In an e-commerce or stock-taking app, Patch can immediately decrement stock levels the moment an item is marked as sold or used.
- User Profile Management: Instead of forcing users to fill out an entire profile form again, you can let them update just their phone number or address, field by field.
Because Patch performs these actions “in-place,” it creates a seamless flow for the user. That’s a huge win for modern app design.
The Basic Syntax Explained
To use Patch effectively, you first have to get comfortable with its syntax. The official Microsoft documentation shows it takes three main arguments. Each one tells Power Apps exactly what to do and where to do it.
The basic formula looks like this:
Patch(DataSource, BaseRecord, ChangeRecord)
Don’t let its simplicity fool you; this structure is incredibly powerful. The DataSource
is your table (like a SharePoint list or Dataverse table), the BaseRecord
is what identifies the specific item you want to change (or tells Power Apps to create a new one), and the ChangeRecord
holds the new data for the fields you’re updating.
Let’s break that down a bit more.
Patch Function Syntax Breakdown
This table summarizes the core components of the Power Apps Patch function and what each part does.
Component | Purpose | Example Usage |
---|---|---|
DataSource | The table you want to modify, such as a SharePoint List or a Dataverse table. | MySharePointList |
BaseRecord | The specific record to update. If creating a new record, use Defaults(DataSource) . | LookUp(MySharePointList, ID = varSelectedID) |
ChangeRecord | A record containing the new values. It’s written as a set of curly braces {} . | { Title: "New Task Name", Status: "Completed" } |
Nailing this syntax is the foundation for building solid, reliable apps. Once you understand how these three pieces work together, you can start tackling all sorts of data challenges.
Creating New Records with Patch
When you need to let users add new items to your data source, the Power Apps Patch
function is what you’ll reach for. Let’s walk through a classic business scenario: building a simple lead capture form for a sales app. We’ll just need two fields for this: one for the new lead’s name and another for their email.
The key to creating any new record with Patch
is the Defaults()
function. Think of it like grabbing a fresh, blank form off a stack, ready to be filled out. It creates a base record with all the default values for your data source’s columns. Using Defaults(DataSource)
as the second argument in your Patch
formula is the standard, accepted way to create new entries, as outlined in Microsoft’s official guidance.
Wiring Up Your Form
So, how do we make this happen? You’ll almost always have a button that users click to save their new information. The real work happens inside this button’s OnSelect property. This is where you’ll write your Patch
formula, telling it which data source to use (we’ll call ours ‘SalesLeads’) and signaling that you’re making a new record by using Defaults()
.
The third and final part of the function is the record itself—the new data. Here, you simply map your form controls (like text input boxes) to the correct columns in your data source.
For our lead capture form, the formula on a “Save Lead” button would look something like this:
Patch(
SalesLeads,
Defaults(SalesLeads),
{
Title: txtLeadName.Text,
Email: txtLeadEmail.Text,
Status: {Value: “New”}
}
)
This snippet simply grabs the text from the txtLeadName
and txtLeadEmail
input boxes and writes it to a brand-new record in the SalesLeads
list.
Let Your Users Know What Happened
It’s a terrible user experience when someone clicks “Save” and nothing happens. Did it work? Did it fail? You should always provide immediate feedback. A simple success notification goes a long way. The easiest way to do this is by chaining a Notify()
function right after your Patch
command.
This flow diagram breaks down the simple, three-part process for using Patch
to add data.

As you can see, you just identify your data source, define the new data, and execute the function to save the changes. It’s pretty straightforward once you get the hang of it.
Here’s a more complete formula for your button that includes this crucial user feedback:
Patch(
SalesLeads,
Defaults(SalesLeads),
{
Title: txtLeadName.Text,
Email: txtLeadEmail.Text
}
);
Notify(“Lead successfully created!”, NotificationType.Success);
Reset(txtLeadName);
Reset(txtLeadEmail);
This improved version does three things: it saves the data, shows a friendly success message, and then clears out the input fields so the form is ready for the next entry. It’s a much cleaner user experience.
Of course, things get more complicated. If you’re dealing with choice columns, people pickers, or lookups, the syntax changes. For a deeper dive into those scenarios, you can read our detailed guide on how to patch a SharePoint lookup field.
Updating Existing Records with Patch
Modifying existing data is just as critical as creating new entries. While adding records is pretty straightforward, the real power of the Patch
function shines when you need to edit information on the fly. This is where you move beyond simple data entry and start building genuinely interactive and responsive applications. In my experience, apps that streamline data modification can boost user productivity by over 30% simply by cutting out unnecessary steps.
Let’s stick with our sales app example. A very common task is updating a lead’s status. Imagine you have a gallery showing all your current leads. Your user needs to be able to select a lead and, with a single click, change their status from ‘New’ to ‘Contacted’.

Pinpointing the Right Record
The secret to a successful update is accurately identifying which record to change. The easiest and most common way to do this is with a gallery’s .Selected
property.
When a user clicks on an item in your gallery (let’s call it GalleryLeads
), Power Apps instantly knows which record they’ve picked. You can then feed this entire selected record directly into the Patch
function.
For example, a button labeled “Mark as Contacted” next to your gallery would have an OnSelect
property that looks something like this:
Patch(
SalesLeads,
GalleryLeads.Selected,
{ Status: { Value: “Contacted” } }
);
Notify(“Lead status updated!”, NotificationType.Success)
This simple formula tells Power Apps to find the record in the SalesLeads
data source that matches the one selected in GalleryLeads
. Then, it updates only the Status
field. Everything else in that record stays exactly the same. It’s this precision that makes Patch
so efficient.
Using LookUp for Targeted Updates
But what if you aren’t working with a gallery selection? No problem. You can also use the LookUp()
function to find the specific record you need to edit. LookUp()
scans your data source and grabs the very first record that meets your criteria. This is fantastic for ensuring data integrity because you know you’re editing the exact record you intended.
The
LookUp()
function is designed to retrieve a single record from a table based on a formula. For edit operations, this is the gold standard for isolating a specific item without relying on a user’s visual selection.
Let’s say you have a lead’s unique ID stored in a variable, varSelectedLeadID
. You could use this formula to update their status:
Patch(
SalesLeads,
LookUp(SalesLeads, ID = varSelectedLeadID),
{ Status: { Value: “Qualified” } }
)
This approach is incredibly robust and a fundamental skill for any serious Power Apps developer. It gives you a reliable way to modify records without being tied to a gallery, making it perfect for background logic or updates triggered from another screen.
While Patch
gives you surgical control, it’s not the only tool for the job. For a detailed breakdown of when to use one over the other, check out our guide on PowerApps Patch vs SubmitForm to help you decide what’s best for your app.
Advanced Patching Techniques for Complex Apps
https://www.youtube.com/embed/LKcuPI0dxEg
Once you’ve got the hang of creating and updating single records, it’s time to explore what the Patch
function can really do. This is where you move beyond simple data entry and start building genuinely sophisticated and efficient business apps.
After all, complex applications rarely deal with data in isolation. Most of the time, you’re managing records that are related to each other. Think about a simple CRM system. You’ll likely have an ‘Accounts’ table and a related ‘Notes’ table. Being able to add a new note and instantly link it back to the correct account isn’t just a nice-to-have; it’s a critical, everyday requirement.
To pull this off, you’ll need to work with lookup columns directly within your Patch
function. When you create a new note, for instance, your formula must tell the ‘Notes’ table which account it belongs to. This is done by passing the GUID (Globally Unique Identifier) of the parent ‘Accounts’ record into the note’s lookup field.
Working with Related Tables
Let’s imagine a practical scenario. You have a gallery of accounts on your screen, named galAccounts
, and a button to add a new note for whichever account is currently selected.
The Patch
formula on your “Add Note” button might look something like this:
Patch(
Notes,
Defaults(Notes),
{
Title: “Follow-up Call”,
NoteText: txtNoteInput.Text,
‘Regarding (Accounts)’: galAccounts.Selected
}
)
In this example, the key is 'Regarding (Accounts)': galAccounts.Selected
. Here, galAccounts.Selected
doesn’t just provide a single value; it provides the entire record of the chosen account. Power Apps is smart enough to interpret this and correctly populate the ‘Regarding (Accounts)’ lookup column, creating that crucial link between the new note and its parent account.
For a deeper dive into lookup fields and other column types, the official documentation on the Patch function is an excellent resource.
Performing Bulk Updates with ForAll and Patch
One of the most powerful combinations in your Power Apps toolkit is using Patch
inside a ForAll()
function. This dynamic duo lets you loop through a collection of items—like all the rows in a gallery—and run an update for each one.
Picture a project manager staring at a long list of tasks. Instead of clicking “Update” on each individual task to change its status, they could select a handful and update them all with a single click. This is a massive improvement to the user experience for any app that handles lists of items.
Key Takeaway: The
ForAll
function evaluates a formula for every record in a table. When you pair it withPatch
, you create an engine for mass updates. It processes each record in your source collection and applies the changes you specify to your data source.
Let’s build on that project manager example. Assume you have a gallery named galTasks
that displays project tasks, and each task has a checkbox next to it. The user can check off the tasks they want to mark as complete and then click a “Complete Selected” button.
The formula for that button would look like this:
ForAll(
Filter(galTasks.AllItems, chkIsSelected.Value = true),
Patch(
Tasks,
ThisRecord,
{ Status: { Value: “Completed” } }
)
)
Let’s break that down. First, the Filter
function grabs only the gallery items where the checkbox is ticked. Then, ForAll
takes that filtered collection and loops through it. For each item in the loop (referred to as ThisRecord
), it patches the main Tasks
data source, setting the Status
field to “Completed.”
This is an incredibly efficient way to handle bulk modifications. In fact, optimizing these operations can yield dramatic performance gains. One case study showed that it took an average of just 1-2 seconds to update 100 records this way. You can learn more about these benchmarks and how to patch multiple rows like a pro.
Troubleshooting Common Patch Errors and Performance

Sooner or later, every Power Apps developer runs into a stubborn Patch
function. It’s an incredibly useful tool, but when things go wrong, it can bring your development to a grinding halt and hurt your app’s performance. Getting good at spotting and fixing these issues is what separates a decent app from a great one.
Honestly, a lot of the errors are just simple slip-ups. I’ve seen countless cases where someone tries to push a text value into a number column—a classic data type mismatch. Then there’s the infamous delegation warning, a real headache that can cripple your app when you’re dealing with any significant amount of data.
Diagnosing Common Patch Errors
When your Patch
formula breaks, don’t panic. The first thing to do is read the error message Power Apps gives you. It’s usually more helpful than you think and often points you right to the source of the problem, whether it’s a typo or something more complicated.
Here are a few of the usual suspects I see all the time and how I tackle them:
- Delegation Warnings: You’ll see these pop up when your formula can’t be passed to the data source for processing. This happens with large datasets (usually over 2,000 records) if you’re using a non-delegable function to find the record you want to update. Power Apps tries to compensate by pulling a limited number of records locally, which means your patch might not work or, worse, update the wrong thing. The solution? Make sure your
LookUp
orFilter
is using columns and functions that are delegable for your specific data source. The official Microsoft documentation on delegation has a full list. - Data Type Mismatches: This one’s straightforward but easy to miss. If you attempt to save “Hello” into a number field or an invalid value into a choice column,
Patch
will fail. Always double-check that the data types in your record{}
match the columns in your data source. - Network Errors: Sometimes, the problem isn’t your code—it’s the connection. A momentary network blip can cause a
Patch
to fail. You can build a more resilient app by wrapping yourPatch
function in anIfError()
statement to handle these connection drops gracefully.
Optimizing Patch Performance for a Better User Experience
Beyond outright errors, slow performance is the silent killer of user adoption. A laggy app is a frustrating app, and inefficient patching is often the main culprit. The single biggest performance mistake I see is using Patch
inside a ForAll()
loop that hits a data source directly. This sends a separate request to the server for every single record, which is incredibly slow.
In fact, some users have reported noticeable slowdowns when patching as few as 10 to 30 records at once. Operations can take much longer than you’d expect, which has led to calls for better bulk handling capabilities. You can find some great real-world examples and discover seven ways to use the Patch function from other developers’ experiences.
The most effective strategy is to stage your data first. Instead of patching one record at a time, gather all your changes into a local collection. Once you have everything ready, you can update the data source with a single
Patch
operation that sends the entire collection.
This one change can dramatically reduce server calls, often boosting update speeds by over 90%. When you pair this efficient data handling with smart data visualization, your app becomes much more powerful. You can sharpen your presentation skills by exploring different approaches to reporting with Power Apps.
Ultimately, by staging your data and only patching what’s necessary, you’re on your way to building a faster, more responsive, and scalable application.
Common Questions (and Answers) About the Patch Function
Even seasoned Power Apps pros get tripped up by Patch
now and then. It’s a powerful function with a few quirks. Here are answers to some of the most common questions I hear from other developers.
Patch vs. SubmitForm: What’s the Real Difference?
The biggest difference boils down to one word: control. The SubmitForm()
function is designed to do one thing—it takes all the data from a Form control and sends it to your data source. It’s an all-or-nothing operation, great for simple data entry.
Patch
, on the other hand, is your precision tool. It lets you create or change records directly without ever needing a Form control. You can update a single field, combine data from different places, or handle complex, multi-step logic.
Think of it this way:
SubmitForm
is like submitting a complete paper application.Patch
is like having a pen and directly editing a specific line item on that application. For this kind of surgical precision, I always turn toPatch
. Microsoft’s official guide on the Patch function also emphasizes its flexibility for custom scenarios.
How Do I Get the ID of a Record I Just Created?
This is a fantastic feature of Patch
that many people miss. When you use Patch
to create a new record, the function actually returns the entire record it just created—including server-generated columns like the primary ID.
All you have to do is capture that output in a variable. It looks like this:
Set(gblNewRecord, Patch(MyDataSource, Defaults(MyDataSource), {Title: "New Item"}));
After that line runs, the variable gblNewRecord.ID
will hold the unique ID of the item you just made. This is incredibly useful for immediately linking that new record to another one or for navigating the user straight to its edit screen.
Why Is Patch Giving Me a Delegation Warning?
Ah, the dreaded delegation warning. You’ll see this pop up when your Patch
formula includes a filter or lookup that can’t be processed by the data source itself (like SharePoint or Dataverse). When this happens, Power Apps has to pull the data into the app to do the work, and it’s limited to the first 500 to 2,000 records.
If you’re trying to find a specific record to update within a massive dataset, a non-delegable query will fail.
The key is to make sure your lookup logic uses columns and functions that are fully delegable for your specific data source. The official Microsoft documentation on delegation is your best friend here—always check it to see what’s supported.
At SamTech 365, we create practical tutorials and share real-world insights to help you get the most out of the Microsoft Power Platform. Find more of our expert guides at https://www.samtech365.com.