Power Apps: Calculate Mileage Using Bing Maps [Power Platform Series - Ep. 11]
Power Apps: Pop-Up Screens For Deleting Records [Power Platform Series - Ep. 10]
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.
Why Add a Delete Confirmation in Canvas Apps?
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.
Basic Record Deletion in Power Apps
Matt begins by showing how record deletion typically works in a gallery:
- Add an icon (such as a trash icon) inside the gallery template.
- Use the
OnSelectproperty with theRemove()function. - Reference the current record using
ThisItem.
While effective, this method deletes records instantly without confirmation.
Introducing a Confirmation Pop-Up
To prevent accidental deletions, Matt walks through creating a pop-up confirmation screen. This involves layering UI elements and controlling their visibility using variables.
Using Context Variables
A key concept introduced is context variables, which control whether the pop-up is displayed:
- Declare a variable using
UpdateContext(). - Name it (e.g.,
varShowDeleteScreen). - Set its default value to
falsein the screen’sOnVisibleproperty.
This ensures the pop-up is hidden when the app loads.
Building the Pop-Up UI
Matt constructs the confirmation pop-up using the following components:
- A rectangle overlay (with transparency for better UX)
- A label displaying the confirmation message
- A “Yes, Delete” button
- A “Don’t Delete” button
These elements are grouped together for easier control.
Controlling Visibility
The visibility of the pop-up group is tied to the context variable:
- Set the group’s
Visibleproperty tovarShowDeleteScreen - When the variable is
true, the pop-up appears - When
false, it remains hidden
Triggering the Pop-Up
Instead of deleting a record immediately, the delete icon is updated to trigger the pop-up:
- Replace the
Remove()function withUpdateContext() - Set
varShowDeleteScreentotrue
This displays the confirmation screen when users click delete.
Handling User Actions
Matt then configures both buttons in the pop-up:
- Don’t Delete Button:
- Sets
varShowDeleteScreentofalse - Closes the pop-up without deleting the record
- Sets
- Yes, Delete Button:
- Uses
Remove()to delete the selected record - References the selected item via the gallery (e.g.,
Gallery.Selected) - Resets the variable to
falseto hide the pop-up
- Uses
Enhancing User Experience
This 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.
Bonus Insight: Soft Delete Strategy
Matt also previews an alternative method for handling deletions using a “soft delete” approach:
- Add an “Archive” column to the dataset
- Update the value instead of deleting the record
- Filter the gallery to hide archived records
This allows data to be retained while appearing deleted to users.
Conclusion
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.
Sign-up now and get instant access
ABOUT THE AUTHOR
Matt Peterson is a Trainer for Pragmatic Works specializing in the Power Platform. He graduated from the University of North Florida in 2006 and comes with 15 years of teaching experience in high school algebra. Matt earned the accomplishment in 2013 of being named the Florida Gifted Teacher of The Year. His primary focus is helping our customers learn the ins and outs of Power Apps and Power BI.
Free Community Plan
On-demand learning
Most Recent
private training

Leave a comment