<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=612681139262614&amp;ev=PageView&amp;noscript=1">
Skip to content

Need help? Talk to an expert: phone(904) 638-5743

Power Apps: Use Patch To Update and Soft Delete Records [Power Platform Series - Ep. 14]

Power Apps: Use Patch To Update and Soft Delete Records [Power Platform Series - Ep. 14]

In this episode of the Power Platform series, Matt Peterson, Senior Trainer at Pragmatic Works, explores a powerful and practical use case of the Patch function in Power Apps: updating records and implementing a soft delete mechanism. Building on concepts introduced in previous lessons, Matt demonstrates how developers can move beyond basic record creation and leverage Patch to safely manage and modify existing data without permanently deleting it.

 

Understanding the Purpose of Patch

Matt begins by explaining that while Patch is commonly used to create new records without relying on forms, it also plays a crucial role in updating existing records. By attaching Patch to an OnSelect action—such as a button or icon—developers can dynamically update specific fields within a record.

This flexibility makes Patch ideal for scenarios where controlled updates are needed, especially when working with user interactions in apps.

The Problem with Hard Deletes

One of the key challenges discussed is the risk associated with permanently deleting records. Traditional delete operations remove data entirely, which can lead to accidental loss—especially in user-driven applications.

Matt highlights a relatable scenario where a simple misclick could permanently remove important data. To mitigate this risk, he introduces the concept of a soft delete.

What is a Soft Delete?

A soft delete allows developers to mark a record as inactive instead of removing it from the data source. This approach ensures that:

  • Data is preserved for future reference or auditing
  • Users no longer see the record in the app interface
  • Developers maintain full control over data visibility

In Matt’s example, a SharePoint list is used as the data source, containing a simple Yes/No column labeled Active Record.

Implementing Patch for Record Updates

To achieve the soft delete behavior, Matt replaces the traditional Remove() function with a Patch statement. This allows him to update the selected record instead of deleting it.

The Patch logic follows three key components:

  1. Data Source: The SharePoint list (e.g., Patch Demo)
  2. Target Record: The selected item using ThisItem
  3. Update Definition: A field-value pair to modify

In this case, the Active Record column is updated from true to false, effectively marking the record as inactive.

Once implemented, clicking the icon updates the record instantly, demonstrating how Patch can efficiently modify data in real time.

Enhancing User Experience with Conditional Logic

To make the application more user-friendly, Matt adds conditional logic to display “Yes” or “No” instead of raw boolean values. This improves readability and helps users better understand the record status.

This step highlights the importance of combining data logic with UI enhancements to create intuitive applications.

Filtering Out Inactive Records

After marking records as inactive, the next step is to hide them from the user interface. Matt achieves this by updating the gallery’s Items property using a Filter function.

The filter ensures that only records with Active Record = true are displayed.

This approach provides several advantages:

  • Keeps the dataset intact while controlling visibility
  • Improves app performance by reducing displayed data
  • Allows integration with tools like Power BI for further filtering and reporting

As a result, users only see active records, while inactive ones remain stored in the backend.

Adding Notifications for Better Feedback

To further enhance the user experience, Matt introduces a notification using the Notify() function. This provides immediate feedback when a record is “deleted” (soft deleted).

Even though the record isn’t permanently removed, the notification helps maintain user expectations and clarity.

  • Displays a success message after the action
  • Improves usability and responsiveness
  • Reinforces the action performed by the user

Key Takeaways

This session delivers several important insights for Power Apps developers:

  • The Patch function is not limited to creating records—it is highly effective for updates
  • Soft delete is a safer alternative to permanent deletion
  • Combining Patch with Filter enables powerful data visibility control
  • User experience can be improved through conditional formatting and notifications

Conclusion

Matt Peterson provides a clear and practical demonstration of how to use Patch for updating records and implementing a soft delete strategy in Power Apps. By replacing destructive actions with controlled updates, developers can build more reliable, user-friendly applications.

This approach not only safeguards data but also enhances overall application design, making it a valuable technique for anyone working within the Microsoft Power Platform ecosystem.

 Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Power Apps and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.  

Sign-up now and get instant access

Leave a comment

Free Community Plan

On-demand learning

Most Recent

private training

Hackathons, enterprise training, virtual monitoring