Error Handling in Canvas Apps Power Apps using IfError

By | April 16, 2021

Introduction

Canvas App is no code/low code business app with which you can design an app by dragging and dropping elements onto a canvas. It is used to build mobile apps along with many functionalities. Recently, we had a requirement to create a feedback app for which we used Canvas App. As this app will be used by salesperson there are chances of them making mistakes while capturing feedback from customers. However, our Canvas App is efficient enough to catch mistakes and provide an appropriate message to salespeople so they can use the app properly.

Suppose an error occurs while submitting the feedback then the app will display a proper message. This will help the salesperson to understand what went wrong and handle it properly. To handle error and give the appropriate message ‘IfError’ and ‘isError’ functions are introduced in the Canvas App.

Note: Currently these functions are available in Experimental features section.

To use these functions, we need to enable Formula-level error management. To enable Formula-level error management please follow the steps given below:

  • First, click on File in Canvas App.
  • Go to Settings -> Advanced Settings.
  • Go to Formula-level error management and enable it.

Error Handling in Canvas Apps Power Apps

Since we have developed a feedback app, if any error occurs when the user enters the feedback and clicks on submit button then it is necessary to provide some generic and appropriate message to rectify the error.

We have written the below code which will be shown in case of any error after clicking the submit button.

IfError(Patch(Feedbacks,First(Feedbcks), {‘Name’:txtName.Text,’Email’:txtEmail.Text,’Description’:txtDesc.Text,’Rating’:txtRating.Text}),Notify(“Some error occurred while submitting. Please try again.”))

When user clicks on the submit button and if any error occurs then it will show following error message:

Error Handling in Canvas Apps Power Apps

Conclusion

As illustrated above, with the help of Formula Level Error functions we can provide an appropriate error message to users.

inolink

Leave a Reply

Your email address will not be published. Required fields are marked *