web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Do this, wait for butt...
Power Apps
Suggested Answer

Do this, wait for button press, then continue?

(0) ShareShare
ReportReport
Posted on by 103
I am hoping to simplify my app building by creating a component that can be used for all yes or no questions. Since all questions won't be the same, the buttons would just be generic triggers.
 
Lets use deleting an item from a gallery as an example.
 
You have a component named "Yes-No" with two buttons, Yes and No.
 
In a gallery there is a Delete button for each item. When pressed, it triggers a variable that makes my "Yes-No" component visible, then it waits for a button press from the Yes/No component. If "yes" is pressed, remove this item, if "no" is pressed, change the variable to make the Yes-no component not visible again.
 
Is there a way to do this?
Categories:
I have the same question (0)
  • Suggested answer
    mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at
    hey 
     
     
    this video should solve your issue i guess:
     
    if it did please mark my answer as verified,
     
     
    thanks
  • wwmn Profile Picture
    103 on at
     
    It does not solve this question.
     
    The issue with the videos solution is the Yes or No button still holds the code. The Yes button has the OnSelect to Remove('Source', ThisGallery.ThisItem), so it can only be used to remove items from that specific gallery.
     
    What I was hoping to achieve is the Yes and No buttons are essentially blank so they could be used for any gallery on any screen for any type of yes or no question. This way I don't have to recreate containers on each screen, or for each gallery.
     
    For example, this doesn't work, but hopefully it paints the picture of what I'm trying to do.
     
    OnSelect for the gallery item Delete button:
     
    Set(varConfirmPopUp, true);
     
    **Waits for you to press yes or no button on the popup**
     
    If('Yes-Btn".Pressed, Remove('Data', ThisItem), If('No-Btn'.Pressed, Set(varConfirmPopUp, false)))
     
     
     
    But then that same popup could be used to add an item on a Different screen.
     
    OnSelect for the Add button:
     
    Set(varConfirmPopUp, true);
     
    **Waits for you to press yes or no button on the popup**
     
    If('Yes-Btn'.Pressed, Patch('Data', Defaults...........), If('No-Btn'.Pressed, Set(varConfirmPopUp, false)))
     
     
     
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at
    hello
     
    i dont think that this is possible, so that you only have 1 popup that can be used in the entire app.
     
    you could follow this video:
     
    and when the popup is ready you can group all controls together and copy paste it on any screen you want. so you do not have ti recreate it over and over again.
     
     
     
    cheers
  • timl Profile Picture
    36,393 Super User 2025 Season 2 on at
    Hi wwmn,
     
    Yes, it's possible to do this. The piece that you're missing is to define 'Event Properties' in your component. 
     
    For example, you would create 2 properties in your component called OnOKButtonSelect and OnNoButtonSelect.
     
    In your component, you would raise these event by calling them in the OnSelect property of your Yes and No buttons. You would do this like so:
     
    Yes button OnSelect - YourComponent.OnOKButtonSelect() 
    No button OnSelect - YourComponent.OnNoButtonSelect() 

    In the gallery screen for your app, you can then handle these events.
    In the instance of the component that's on your gallery screen, you can add the following to the OnOkButtonSelect property of your component.
     
    Remove('Data', varRecordToDelete);
    Set(varConfirmPopUp, false)
     
    This assumes that you set the varRecordToDelete variable in the OnSelect property of the delete button in your gallery.
     
    Set(varConfirmPopUp, true);
    Set(varRecordToDelete, ThisItem);
     
    For the  OnNoButtonSelect property of your component, you can just set varConfirmPopup to false.
     
    The documentation for Event properties is here.
     
    Hopefully this is of some help to you.
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard