Canvas App – Can we rollback all patches  from a  button click if error occurs for one?
Image Source: Shutterstock.com
Power Apps
Aug 8, 2023 12:00 PM

Canvas App – Can we rollback all patches from a button click if error occurs for one?

by HubSite 365 about Suparna Banerjee

Cloud Solution Architect at Microsoft UK | Power Platform

Citizen DeveloperPower AppsLearning Selection

In Canvas App, there are scenarios when we write multiple Patch statements in a single button click to submit data into multiple table or lists. These data inse

In Canvas App, when multiple Patch statements are written to submit data across different tables or lists, there may be a problem if any of these fail during the operation. In this scenario, users often want to rollback the insert for the other data sources as well. While SQL server provides the option to Rollback Transaction, Canvas App does not have this option in Power Fx.

A workaround example is presented with an online shopping Canvas App where buyers can submit their Product details and modify the price later. To keep the historical pricing data, two SharePoint lists are used: 'Online Shopping' and 'Price History'. On button click, the app updates or inserts into the 'Online Shopping' list, obtains the ID of that record, and then inserts it into the 'Price History' list along with the date and price.

  • If the first patch into the 'Online Shopping' list fails, it would not conduct the second patching of the 'Price History' list and would show an error message.
  • If the first patch is successful but the second patch fails, it would delete the corresponding entry from the first list and show an error message.

To facilitate error handling in a Canvas App, the Preview Feature 'Formula Level Error Management' must be enabled in Settings>Upcoming Features>Preview.

 

Insights on Handling Errors in Canvas App

The management of errors in a Canvas App is pivotal to ensure smooth operations, especially when dealing with Patch statements across multiple platforms. A typical approach includes error messages in cases of failed patches, effectively guiding the user in resolving and preventing further complications. This feature is enabled through the 'Formula Level Error Management' preview. With the importance that the technology industry places on data integrity and error handling, seeking and implementing solutions like this one enables Canvas Apps to tackle challenges smartly.

Read the full article Canvas App – Can we rollback all patches from a button click if error occurs for one?

Learn about Canvas App – Can we rollback all patches from a button click if error occurs for one?

 

Canvas App enables users to rollback all patches from a button click if an error occurs for one. This is possible by using the option to Rollback Transaction in SQL server that discards all the data updates inside a transaction. However, in Canvas App, there is no such straight forward option. To handle this situation, there is a workaround. For example, in an Online Shopping Canvas App, the buyers submit their Product details. The Price history of the Product is recorded in two SharePoint Lists - Online Shopping and Price History. To enable Error handling in a Canvas App, users must turn on the Preview Feature Formula Level Error Management from Settings>Upcoming Features>Preview. The OnSelect Property of the Submit Button Click contains a code to Patch the Online Shopping list. If an error occurs in this Patch statement, the Notify message will appear and the data will not be inserted into the Price History list. If the first Patch is successful, but the second Patch fails, then it will delete the corresponding entry from the first list and show an error message.

 

More links on about Canvas App – Can we rollback all patches from a button click if error occurs for one?

Error Handling and rollback - Power Platform Community
Aug 8, 2019 — I am using the below formula onSelect of a button:- (noteid is an. ... "SN" and "NB", can that be one reason for patch function failure?
Power Apps Patch Function Error Handling
May 9, 2021 — It is important to perform patch function error handling In Power Apps any time you are updating records in a datasource.
After You Update: Performing a Patch Rollback
Although you can only roll back to the last version that was installed on the appliance, if multiple hotfix patches are included within the cumulative patch ...
Error Handling with the Patch function in Canvas Apps
Mar 5, 2021 — The Patch function returns the record you just created or modified. It will be blank if there was an error. This record returned can be saved ...
Known issues in Photoshop
Jul 25, 2023 — Find known issues and limitations in the latest releases of Photoshop.
Tokyo Patch 3
Nov 10, 2022 — In Agent Workspace, the CPU usage is high when a user clicks Clear All after making field changes on the opening filter under the 'Activity' tab ...

Keywords

microsoft canvas app, microsoft power fx, rollback transaction, online shopping list, price history list, preview feature, formula level error management