How To Communicate Status in PowerApps
When developing modern applications, it is important to communicate what our applications are doing with the end-user. As with anything, results will commensurate with what you put in. Good feedback makes our users feel confident. Even some poorly implemented feedback to the end-user provides them with something to go on. But what’s even worse, is no feedback at all.
If you are new to Power Apps you may not be familiar with the method of improving user experience for your Power Apps using banner notifications. It’s really quite simple to implement and can add much needed feedback, giving users confidence in your application and providing avenues for troubleshooting issues if the need arises.
Use the Notify Method
Let’s dive right in with some hands-on examples of banner notifications. This simple method, relies on the use of the `Notify` function in Power Apps. Technical details on this function can be found here… https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-showerror
But I also want to give you a quick demonstration of how you might use this in your Power Apps applications. The `Notify` function, like any other function, can be called when any event is fired in a Power App. A typical way you might use this function is to add it to any of your data saving or submit operations in your forms.
To do this, simply select the button used to save or submit your data. In the `OnSelect` for that button or control, after the function used to save or submit the data, add the following:
`Notify(“Form data has been submitted and saved successfully.”, NotificationType.Success);`
This is great, right? Every time the user clicks the button, the data is saved and the user gets confirmation of that. All you have to worry about here is the message you want to communicate and the type of status. The reason I am showing you this simple method is to demonstrate that the `Notify` function can be used pretty much anywhere to help let the user know what is happening. In the scenario you allow the user to delete a record or call a `Flow`, you can give them status.
But there are some other things to consider. In cases where there is a failure saving data or performing the operation, we want to catch that and communicate with the user. Also, in cases where the form cannot be submitted or the operation cannot be performed, we want to let the user know. Here is how you handle these scenarios.
In the case that the form is not in a savable state, meaning it has invalid data, you want to be sure to check this state prior to submitting the form. Fortunately, Power Apps has much of this built in to the default form state and `SubmitForm` functionality. By default, any `SubmitForm` function will trigger a check of the form’s valid state and will fail if anything in the form is not valid. If you’re missing a required field or maybe you entered some invalid data in a text field, these will show up as invalid for the form and a submit will result in a `Failure`. Likewise, if the form is valid, and the data is saved, the `SubmitForm` function will result in a `Success`. The outcome of the `SubmitForm` will trigger the `OnFailure` or `OnSuccess` event of the form.
So, a better way to leverage the `Notify` function in the `SubmitForm` scenario is to add the `Notify` function to the `OnSuccess` and `OnFailure` events for the form. To do this, select the form, then select the `OnSuccess` or `OnFailure` event and add the `Notify` function.
`Notify(“Request created successfully.”, NotificationType.Success)`
Also note in the case of a failure you can utilize the `Error` and `ErrorKind` values to determine what type of message to show the user. In this case we’re checking the `ErrorKind` or the form `Valid` state for validation errors.
`If (ErrorKind = ErrorKind.Validation || NewForm1.Valid = false, Notify("Unable to create request: Form data is invalid."), Notify("Unable to create request: Contact your Power Apps Administrator."))`
Types of Notifications
One last note is that there are three basic types of Notifications in Power Apps today. These are `Success`, `Error`, and `Information`. It’s always a best practice to use them appropriately and consistently across your applications.
In the example above, we used the informational type of notification to let the user know that there was a validation issue with the form.
Conclusion
That’s it. It’s a very simple mechanism for communicating what’s going on to your end users. Give your users confidence knowing their interactions are successful. Be consistent with your use of this technique so that users will come to expect it. Reduce end user frustration and they’ll communicate positive feedback in turn.
Is Team Communication Holding You Back?
Find Out in Just 2 Minutes.
Take our quick scorecard to uncover communication gaps and hidden barriers within your team.