Skip to content

Power Apps Error Function

Using the Power Apps Error Function.

Eric Gregorich
Eric Gregorich
1 min read

Table of Contents

Microsft Power Apps has an Errors() function that will capture any errors from an executed data source and allow you to view those errors and handle them gracefully. It can be easy to forget to use the Errors() function because it is not apparent in the UI. You may be getting errors with your Patch statements, but the user would never know because you're not checking for errors.

A typical pattern for handling errors with a Patch statement would look like this.

Patch('my data source',Defaults('my data source'),{ColumnA:"value",ColumnB:"value",ColulmnC:"value"});If(IsEmpty(Errors('my data source')),Notify("Success!",NotificationType.Success),Notify(First(Errors('my data source')).Message,NotificationType.Error))

In this example, if there is an error when inserting a record into the data source, it will contain the error message. For example, if Column A was required in the data source, but the value was empty, the message would return "Column A is required.".

Power Apps

Eric Gregorich Twitter

I design and build software solutions that help companies and people be more productive.

Related Posts

How to access environment variables in a Canvas Power App

How to access Environment Variables for text and other data type values from your canvas Power App. Useful for managing settings for environments.

An example app with a text label control.

Name too long error in Power Apps

An error appears in Microsoft Power Apps. There was a problem saving your data. The name could be too long. This only occurs when using the SaveData function to save data to the device. There may be too much data in the collection that is being saved, but the data

Microsoft Power Apps Icons

Microsoft Power Apps has a few icons built-in that we can use in our applications. If you want more options, you can follow these simple steps. ^ 1. Go to the site Power Apps Icons. 2. Search for the icon name to find the one you want. 3. Click the color

Microsoft Power Apps Icons