OnFailure Trigger in Canvas App

The OnFailure trigger is a common trigger used in canvas apps, which fires when a form control fails to submit data to a data source. This trigger is used to perform actions when a user submits a form and the data fails to save to the data source.

The OnFailure trigger allows you to specify actions that should be performed when a form control fails to submit data to a data source. For example, you might use the OnFailure trigger to show an error message, to provide guidance to the user on how to fix the error, or to log the error for debugging purposes.

To use the OnFailure trigger in a canvas app, you first need to add a form control to your app. You can do this by selecting the Form control from the Controls menu in the left-hand pane of the Power Apps Studio. Once you’ve added a form control to your app, you can define the data source it should submit to and the actions that should be performed when the submission fails.

To define the OnFailure trigger for a form control, you can select the control and then go to the OnFailure property in the formula bar. From there, you can enter a formula that defines the actions that should be performed when the form data fails to submit.

For example, if you have a form control named “MyForm” that submits data to a SharePoint list, you can define the OnFailure trigger for that control by entering the following formula in the formula bar:

MyForm.OnFailure = Notify(“Data failed to submit. Please try again later.”, NotificationType.Error)

In this example, the OnFailure trigger for the MyForm control shows an error notification message when the form data fails to submit to the SharePoint list.

The OnFailure trigger is a useful feature that allows you to provide feedback to users when something goes wrong in your app. However, it’s important to use it judiciously and only when necessary, as too many triggers can make your app slow and difficult to maintain.


Posted

in

by

Tags: