Power Apps patch function: update or create records

Go back to Glossary
Share:

Understanding the Power Apps Patch Function

What is the Patch Function and Why Use It

The Patch function in Power Apps is a key tool for managing data in canvas apps. It allows you to create new records or update existing ones in various supported data sources, like SharePoint Lists and Microsoft Dataverse. What makes Patch so practical is that you can update just the fields you want in a record, or add new entries, all without having to rely on the standard form controls. In a nutshell, Patch helps streamline business processes, cuts down on repetitive manual work, and helps keep your data consistent across different applications.

It’s worth considering that Patch becomes even more valuable in organizations where flexibility and automation are a priority. Since Patch works within the Power Fx formula language, you can embed it in custom buttons, icons, and even automated flows—making the user experience more flexible than what you get with standard forms. For businesses using the Microsoft Power Platform to modernize workflows, Patch is a great low-code way to build business logic right into your app screens, so you don’t always have to depend on IT or custom coding.

Patch vs SubmitForm vs Update: Key Differences

While Patch, SubmitForm, and Update all let you change data in Power Apps, each one has its own place.

FunctionBest Use CaseFlexibilityBulk OperationsRecord CreationCustom Logic
PatchUpdate specific fields, create records, custom UIHighYesYesYes
SubmitFormSubmit or edit entire record via formMediumNoYesLimited
Update/UpdateIfModify records meeting criteriaLowYesNoLimited
  • SubmitForm is handy for basic, form-driven apps—thanks to its built-in validation and error handling.
  • Patch is the go-to when you need more control, like updating only a few fields or working with custom UI elements.
  • Update/UpdateIf are often used in bulk changes, but they don’t have the versatility Patch offers for creating new records or handling conditional logic.

For instance, if you want to update a status field based on what the user clicks in a gallery or on a button instead of a form, Patch is usually the better option.

When to Choose Patch Over Other Methods

You’ll want to use Patch when your app needs to:

  • Update certain fields
  • Run more complex logic
  • Create records on the fly without a full form
  • Update many records at once
  • Integrate with automated workflows
  • Handle updates based on user roles, approval steps, or data from connected systems

For example, in an approval workflow where only certain fields get updated at each stage, Patch lets you control exactly which fields are changed and when—helping you maintain strong audit trails and meet compliance needs.

Power Apps Patch Function Syntax and Basic Implementation

Single Record Syntax and Parameters

The basic Patch syntax for updating or creating a single record looks like this:

Patch(DataSource, BaseRecord, ChangeRecord)
  • DataSource: Where your data lives
  • BaseRecord: The record you want to update (or use Defaults for new ones)
  • ChangeRecord: The fields and new values

Example:

Patch(Employees, Gallery1.Selected, {Department: "Sales"})

This only changes the Department field for the selected employee.

If you need more advanced options, you can add extra parameters for things like concurrency control or related records.

Is your business ready for automation?

Automate processes with Microsoft Power Platform.

Multiple Records Syntax for Bulk Operations

Patch also lets you handle multiple records in one go:

Patch(DataSource, TableOfRecords, TableOfChanges)

This comes in handy for batch jobs, like updating the status of several tasks at once. Doing bulk updates this way is much faster because it cuts down the number of operations sent to your data source.

For example, a manager can filter support tickets and apply a status update in a single step.

Essential Functions: Defaults, Selected, and Lookup

  • Defaults: Used with Patch to create new records by giving you a template for your data source.
    • Patch(Employees, Defaults(Employees), {FullName: "Jane Smith"})
  • Selected: Helpful with galleries or forms to pick which record to update.
    • Patch(Employees, Gallery1.Selected, {Status: "Active"})
  • Lookup: Lets you find a specific record based on a condition.
    • Patch(Employees, Lookup(Employees, EmployeeID = 101), {Manager: "A. Brown"})

These functions make your data operations more accurate and flexible.

Creating New Records with Patch Function

Basic Record Creation Syntax

To add a new record, just use Patch with the Defaults function:

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

This creates a new entry in your data source with the values you provide.

Working with Different Data Types

Patch works with all sorts of data types:

  • Text
  • Numbers (may require conversion from text input)
  • Dates (use Date() or DateValue() for formatting)
  • Booleans (use true/false or toggle control values)
  • Choice/dropdown fields (require specific syntax)

For instance, when updating a date field in SharePoint, use DateValue(DatePicker1.SelectedDate). With Dataverse, for a choice field, use {Status: {Value: "Active"}}.

Using Defaults Function for New Records

Defaults gives you a template for a new record and makes sure all required fields are ready to go. Pairing Defaults with Patch helps you avoid common schema mistakes and keeps your data clean.

Practical Examples for SharePoint and Dataverse

  • SharePoint Lists:
    Patch(Tasks, Defaults(Tasks), {Title: "New Task", Status: "Not Started"})
  • Dataverse:
    Patch(Contacts, Defaults(Contacts), {FirstName: "Alex", LastName: "Green", Email: "alex.green@domain.com"})

In SharePoint, you can also use Patch to set metadata, assign tasks, or even kick off workflows when you update a list item. In Dataverse, Patch can help you work with related tables—like creating a contact and linking it to an account.

Updating Existing Records with Patch

Identifying Records for Updates

To update a record, Patch needs to know which one. This is usually done with:

  • The Selected property from a gallery or form
  • Lookup to find a record by a unique ID

You can also combine Patch with filters or variables to pick records dynamically.

Partial Record Updates

Patch lets you update just the fields you specify in ChangeRecord, leaving the rest untouched. This is useful in apps where users can only edit certain fields—like changing a status or adding a comment—while keeping sensitive info safe.

Bulk Update Operations

Bulk updates are possible by passing tables of records and changes into Patch. This is great if you need to update lots of records at once, like closing several support tickets in one go.

Galleries usually show lists of records. Patch can use the Selected property to update whichever item the user has highlighted. If you’re working with form data, you can reference the values directly in Patch to update the right record.

Data Sources: SharePoint Lists vs Dataverse

SharePoint Lists Implementation

When you use SharePoint Lists as your data source, Patch interacts with the columns you’ve set up in that list. SharePoint Lists are a good fit for team collaboration apps or document management. Patch can add or update items, but keep in mind:

  • The 5000-item threshold
  • The difference between internal and display column names
  • Features like versioning, item-level permissions, and integration with Teams or Outlook

Dataverse Implementation

Dataverse brings advanced features like relational data, business rules, and strong security models. Patch works with Dataverse tables to create or update records. Dataverse also supports:

  • Field-level security
  • Business process flows
  • Integration with Dynamics 365
  • Regulatory needs like GDPR or HIPAA

Choosing the Right Data Source

Consider the following when choosing between SharePoint Lists and Dataverse:

  • Business needs
  • Data volume
  • Security requirements
  • Integration plans
  • Licensing
  • Data governance
  • Future growth

For some industries, compliance or integration with other Power Platform tools might make Dataverse a better fit.

Performance Considerations

Performance can change a lot depending on your data source:

  • Dataverse usually handles large datasets and complex tasks better
  • SharePoint Lists might need tuning for delegation and view thresholds

For best results:

  • Use server-side filtering
  • Keep Patch operations to a minimum
  • Batch updates when possible

Advanced Patch Function Use Cases

Streamline your Power Apps solutions by utilizing power platform consulting services. Whether you’re dealing with upsert operations or multi-table transactions, our expertise can enhance your app’s performance and effectiveness.

Upsert Operations (Create or Update)

Patch can handle upsert logic—meaning it will create a record if it doesn’t exist or update it if it does. Usually, you check for the record’s existence with Lookup before running Patch.

Multi-table Operations

Sometimes, your business processes will require updating related tables. Patch can work with other Power Fx functions to manage these relationships and keep your data consistent across different tables.

Conditional Patching Logic

You can use Patch with If or Switch functions to update records based on specific conditions. This is handy for building apps that follow advanced rules or workflows.

Integration with Power Automate

Patch can kick off Power Automate flows for follow-up actions, like sending notifications or updating external systems. For example, after a Patch runs successfully, a flow can send a confirmation email, update a CRM, or log the transaction for auditing.

Error Handling and Validation Strategies

Using IsError and IfError Functions

  • IsError and IfError are your go-to functions for catching and managing errors during Patch operations.
  • They help your app handle things like bad data or network hiccups by showing users feedback or giving them alternate options.

Implementing the Errors Function

  • The Errors function gives you details on why a Patch failed.
  • Developers can use this info to show clear error messages or log the issues for later troubleshooting.

Pre-submission Validation Techniques

  • Validate data before running Patch.
  • Check required fields, formats, and business rules with formulas or the Validate function.

Network Error Handling

  • Use retry logic or offline support so users don’t lose their work.
  • Power Apps lets you keep working offline with certain data sources and sync changes once you’re reconnected.

Performance Optimization and Best Practices

Concurrent Operations for Better Performance

  • The Concurrent function lets you run multiple Patch operations in parallel, speeding up batch updates and making the app feel faster for users.
  • Watch for data conflicts and make sure parallel updates don’t mess up related records.

Delegation Considerations

  • Delegation is about letting Power Apps process data on the server instead of locally.
  • Patch is usually delegated, but some data operations can’t be delegated and might limit your results.
  • Check for delegation warnings in Power Apps Studio.

Batch Processing Strategies

  • Combine multiple changes into a single Patch operation to cut down on network traffic and speed things up.
  • Use collections to stage your changes before running Patch.

Common Performance Pitfalls

  • Non-delegable queries
  • Too many network calls
  • Inefficient loops

Stick to best practices—like minimizing Patch calls and using collections—to avoid these problems.

Troubleshooting Common Patch Function Issues

Column Accessibility Errors

  • Schema changes, permission issues, or incorrect column names can cause errors.
  • Double-check names and permissions.
  • In SharePoint, internal and display column names can be different.
  • In Dataverse, field-level security might block access to certain columns.

Data Type Mismatch Problems

  • Make sure you’re assigning the right kind of value and use conversion functions like Value(), Text(), or DateValue() as needed.
  • Test Patch operations with different data types and use explicit conversions.

Permission and Security Issues

  • Lack of write permissions can cause Patch to fail.
  • Make sure your users have the right roles and permissions for the data source.
  • Integrate with Azure Active Directory and use role-based access control for larger organizations.

Network Connectivity Problems

  • Unstable network connections can interrupt Patch operations.
  • Use retry logic and offline support.
  • For critical apps, consider using transaction logs or Power Platform’s monitoring tools.

Real-world Examples and Implementation Patterns

Employee Management System

Patch helps onboard new employees, update their profiles, or change their job status. For example, you can create a new employee record or update an existing one with promotion details.

HR staff might use a Power Apps screen to update job titles, assign training, or deactivate records for employees who leave—all with Patch handling those specific updates.

Inventory Tracking Application

In inventory apps, Patch updates stock counts, logs shipments, or creates new product records. You can even do bulk updates for multiple products after a shipment comes in.

Are you ready to discover the joy of automation?

Whether you have a project in mind or just want to know how we can help, we’re happy to have a conversation

This supports just-in-time inventory processes and can tie in with barcode scanners or IoT sensors for automatic updates.

Customer Feedback Form

Patch records customer feedback, updates response statuses, and logs what actions were taken to resolve issues. By updating only the necessary fields, Patch helps preserve historical data.

Customer service teams can use Patch to update ticket statuses, assign cases, or escalate issues, keeping everything tracked for reporting and quality control.

Multi-step Approval Workflow

Patch supports multi-step approval processes by updating status fields, saving who approved what, and triggering workflow automations. When you integrate with Power Automate, you can notify stakeholders at every stage.

In industries with strong compliance needs, Patch can log every approval step, capture digital signatures, and provide a full audit trail for reporting—helping you meet standards like SOX or ISO 9001.

Frequently Asked Questions

What is the main advantage of using Patch over SubmitForm in Power Apps?

Patch offers more flexibility, allowing you to update specific fields, create records without forms, and handle complex business logic.

Can Patch update multiple records at once?

Yes, Patch can handle bulk updates by passing tables of records and changes, making it efficient for large operations.

How does Patch handle different data types?

Patch supports text, numbers, dates, booleans, and choice fields. Make sure to use the correct formatting and conversion functions for each type.

What should I do if I get a column accessibility error?

Check for schema changes, permission issues, or incorrect column names. In SharePoint, verify both internal and display names; in Dataverse, review field-level security settings.

Is Patch suitable for integrating with automated workflows?

Absolutely. Patch can trigger Power Automate flows, enabling end-to-end automation and notifications.

Share:
Go back to Glossary

Table of Contents

Need expert guidance on Power Platform solutions? Contact us today for professional consulting
Author
Power Platform Consultant | Business Process Automation Expert
Microsoft Certified Power Platform Consultant and Solution Architect with 4+ years of experience leveraging Power Platform, Microsoft 365, and Azure to continuously discover automation opportunities and re-imagine processes.