<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=612681139262614&amp;ev=PageView&amp;noscript=1">
Skip to content

Need help? Talk to an expert: phone(904) 638-5743

Power Apps: Pop-Up Screens For Deleting Records [Power Platform Series - Ep. 10]

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 OnSelect property with the Remove() 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 false in the screen’s OnVisible property.

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 Visible property to varShowDeleteScreen
  • 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 with UpdateContext()
  • Set varShowDeleteScreen to true

This displays the confirmation screen when users click delete.

Handling User Actions

Matt then configures both buttons in the pop-up:

  1. Don’t Delete Button:
    • Sets varShowDeleteScreen to false
    • Closes the pop-up without deleting the record
  2. 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 false to hide the pop-up

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

Leave a comment

Free Community Plan

On-demand learning

Most Recent

private training

Hackathons, enterprise training, virtual monitoring