In this video, Matt Peterson, a trainer at Pragmatic Works, demonstrates how to enhance user experience and prevent accidental data loss in Power Apps Canvas Apps by implementing a pop-up confirmation screen before deleting a record. This tutorial is part of his ongoing Power Platform series and focuses on improving app usability with simple yet effective techniques.
Deleting records in Power Apps is straightforward, but that simplicity can lead to accidental deletions. Matt highlights the importance of adding a confirmation step to ensure users do not unintentionally remove important data. This is especially useful in real-world scenarios where accidental clicks can occur.
Matt begins by showing how record deletion typically works in a gallery:
OnSelect property with the Remove() function.ThisItem.While effective, this method deletes records instantly without confirmation.
To prevent accidental deletions, Matt walks through creating a pop-up confirmation screen. This involves layering UI elements and controlling their visibility using variables.
A key concept introduced is context variables, which control whether the pop-up is displayed:
UpdateContext().varShowDeleteScreen).false in the screen’s OnVisible property.This ensures the pop-up is hidden when the app loads.
Matt constructs the confirmation pop-up using the following components:
These elements are grouped together for easier control.
The visibility of the pop-up group is tied to the context variable:
Visible property to varShowDeleteScreentrue, the pop-up appearsfalse, it remains hiddenInstead of deleting a record immediately, the delete icon is updated to trigger the pop-up:
Remove() function with UpdateContext()varShowDeleteScreen to trueThis displays the confirmation screen when users click delete.
Matt then configures both buttons in the pop-up:
varShowDeleteScreen to falseRemove() to delete the selected recordGallery.Selected)false to hide the pop-upThis approach creates a safer and more user-friendly interface by requiring confirmation before performing destructive actions. It also introduces reusable design patterns for pop-ups that can be applied to other scenarios, such as viewing details or confirming submissions.
Matt also previews an alternative method for handling deletions using a “soft delete” approach:
This allows data to be retained while appearing deleted to users.
Through this tutorial, Matt Peterson demonstrates how small enhancements like confirmation pop-ups can significantly improve app reliability and user confidence. By leveraging context variables and thoughtful UI design, developers can create more robust Power Apps solutions.
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Power Apps and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.