Power Apps: Use Patch To Update and Soft Delete Records [Power Platform Series - Ep. 14]
Power Apps: Use Patch To Create Records Without Forms [Power Platform Series - Ep. 13]
In this Power Platform training session, Matt Peterson of Pragmatic Works revisits the Patch function and demonstrates how it can be used to create new records in Power Apps without relying on traditional forms. This approach provides greater flexibility in app design and allows developers to fully control the layout and behavior of their input screens.
Why Use Patch Instead of Forms?
Matt Peterson explains that while forms in Power Apps are convenient and easy to use, they come with limitations. Developers can adjust layouts and column structures, but overall customization remains restricted. The Patch function offers an alternative by allowing developers to design fully custom screens with input controls placed anywhere.
This flexibility is especially useful when building applications that require a unique user interface or when form-based layouts do not meet specific design requirements.
Building a Custom Input Screen
In the demonstration, Matt Peterson walks through an application designed to capture park inspection data. Instead of using a form, the app uses individual input controls such as text fields and date pickers placed freely across the screen.
Even without a form, developers can still configure default values for these controls. Examples shown in the video include:
- Automatically setting the inspection date to today’s date
- Populating the user’s email as the default inspector
- Using a selected park ID from another screen
This ensures a smooth user experience while maintaining flexibility in design.
Understanding the Patch Function
Matt Peterson breaks down how the Patch function works when creating a new record. The structure of the function includes three main components:
- Data Source – The table where the record will be stored
- Defaults() – Indicates that a new record is being created
- Field-Value Pairs – Defines what data will be written to each column
Each field in the data source must be mapped to a corresponding control in the app. For example:
- The inspection date uses the SelectedDate property from a date picker
- The inspector name uses the Text property from a text input
- The park ID is retrieved from a text input control
Handling Data Types Correctly
A key concept highlighted in the video is ensuring that data types match between the app and the data source. Matt Peterson demonstrates a scenario where a numeric column receives a text value, which causes an error.
To resolve this, the Value() function is used to convert text into a numeric format. This step is critical when working with SQL tables or other structured data sources.
Saving and Validating Records
Once the Patch function is implemented, the app uses navigation logic to return users to a main screen where they can verify that the record has been successfully created. Matt Peterson emphasizes the importance of referencing the correct screen name to avoid navigation issues.
This validation step ensures that users can immediately confirm their input and that the Patch function is working as expected.
Resetting Input Controls for Better UX
One common issue with custom Patch implementations is that input values remain populated after submission. This behavior overrides default values and can lead to confusion for users when creating new records.
To address this, Matt Peterson recommends using the Reset() function within the screen’s OnVisible property. This approach clears previous inputs and restores default values whenever the screen is opened.
Benefits of using Reset include:
- Clearing previously entered data
- Reapplying default values automatically
- Improving the overall user experience
Key Takeaways
Matt Peterson concludes the session by reinforcing the advantages of using Patch for creating records in Power Apps. While it requires more coding compared to forms, it offers significantly greater control and flexibility.
- Patch allows full customization of input screens
- Defaults() is required for creating new records
- Proper data type handling is essential
- Reset() helps maintain clean and user-friendly interfaces
This session serves as a strong foundation for developers looking to move beyond forms and build more dynamic Power Apps solutions. Future lessons expand on how Patch can also be used to update existing records and handle more advanced scenarios.
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
ABOUT THE AUTHOR
Matt Peterson is a Trainer for Pragmatic Works specializing in the Power Platform. He graduated from the University of North Florida in 2006 and comes with 15 years of teaching experience in high school algebra. Matt earned the accomplishment in 2013 of being named the Florida Gifted Teacher of The Year. His primary focus is helping our customers learn the ins and outs of Power Apps and Power BI.
Free Community Plan
On-demand learning
Most Recent
- Microsoft Teams: Live Meetings [Beginner to Pro Teams Series - Ep. 5]
- Power Apps: Use Patch To Create Records Without Forms [Power Platform Series - Ep. 13]
- Azure Synapse Analytics: Provisioning Apache Spark [Introduction to Synapse Analytics - Ep. 7]
- Power Apps: Use Patch To Update and Soft Delete Records [Power Platform Series - Ep. 14]
private training

Leave a comment