How To Create A Popup Message Or Alert Box In PowerApps

Introduction

While developing a canvas app many times we come across a scenario to create a popup message or an alert box. In this article, we will see how to create a popup confirmation message to delete an item from a gallery.

I have used a standard gallery with a delete button. When a user clicks on a delete button, an alert message should pop up asking for confirmation. If he clicks on "Yes" an item will be deleted and if he clicks on "No" the popup will be hidden and no action will be performed on that item.

Below is my typical horizontal gallery where you can see a delete button to delete the particular record

How To Create A Popup Message Or Alert Box In PowerApps

To create a popup in PowerApps, we will use a group of controls like rectangles, labels, and buttons. We will set a visible property of this group with one variable. This will allow us to show and hide the popup based on variable value.

Step 1. Set a variable named varShowPopup on click on the delete button

How To Create A Popup Message Or Alert Box In PowerApps

Step 2. Add different controls to create a popup on the screen

  1. Add a full-screen rectangle and change the color opacity to 0.5 as shown below. This will make the rectangle transparent.

    How To Create A Popup Message Or Alert Box In PowerApps
  2. Add another white color rectangle, labels for popup heading and message, close button, save button and make a group of these controls as shown below,

    How To Create A Popup Message Or Alert Box In PowerApps
  3. Set the visible property of this group to "varShowPopup". This is the same variable that we have initialized in Step 1.

    How To Create A Popup Message Or Alert Box In PowerApps
  4. Set the variable to false, so that a popup will be hidden on the click on the close button.

    How To Create A Popup Message Or Alert Box In PowerApps
  5. Similarly for the delete button, write whatever formula you want to perform on click on the delete button, and at the last set varShowPopup variable to false so that the popup will be hidden. In this case, I am writing the remove function to delete the selected record and at the end, I am setting the variable to false.

    How To Create A Popup Message Or Alert Box In PowerApps

Output

How To Create A Popup Message Or Alert Box In PowerApps


Similar Articles