Error Handling in PowerApps

| Hammad Hussain

In this blog, we will learn how to handle errors in Canvas Applications and Model Driven Applications. It is the most common requirement of any system so that users don’t need to deal with sudden issues that they can’t understand.

Error Handling in Model Driven Applications

If we want to deal with an error in Model Driven Applications, we use JavaScript customization. Let’s suppose we want to show a pop-up error to user that says something that the user will understand instead of the actual error message that would probably confuse the user.

When performing the customization on the application with JavaScript, we need to use Xrm functions to show an error dialog. See the following code as an example:

Xrm.Navigation.openErrorDialog({errorcode:”1234”,details:”shows the details on the screen”,message:”Here’s the message”}).then(successCallback,errorCallback);

Graphical user interface, text, application

						Description automatically generated

Error Handling in Canvas Applications

In Canvas Applications, we have simple functions of Power Fx to deal with errors in different ways, such as:

  • IsError
  • IfError
  • IsBlankOrError

IsError

It returns a Boolean value of true or false by identifying it is an error or not, it prevents any further processing of the error.

IsError(x)

IfError

It is used to replace an error with a valid value so that rest of the calculations can continue. For example, if user input might result in a division by zero:

IfError( 1/x, 0 )

IfBlankOrError

It check if the value is blank or an error value, it is better to use this function instead of IsBlank as it achieves two goals at once. For example:

IsBlankOrError(x)

Join us next time, as we continue our journey of learning canvas apps.Click here to learn more about Imperium's Power Apps Services. We hope this information was useful, and we look forward to sharing more insights into the Power Platform world.


M
Chief Architect, Founder, and CEO - a Microsoft recognized Power Platform solution architect.

About The Blog

Stay updated with what is happening in the Microsoft Business Applications world and initiatives Imperium is taking to ease digital transformation for customers.


More About Us

We provide guidance and strategic oversight to C-Suite and IT Directors for on-going implementations. Feel free to give us a call.

1 331 250 27 17
Send A Message

Ready to Start?

Get a personalized consultation for your project.

Book a Meeting