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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Dynamic Message Box
Power Apps
Unanswered

Dynamic Message Box

(0) ShareShare
ReportReport
Posted on by

I've created a component in my app that is a message box with Yes/No options.  I've then added custom properties to set the Title, Message, and actions for each of the clicks (set to Property type Event).

 

This works a treat when setting each of the values to a variable on my canvas and I can pop up the message with a custom title and message but I want to be able to set the actions to a variable as well - how can I add an action to a variable eg set a variable to "Set(varMessageBoxVisible, false)" and then use that variable for the OnSelect action of the button.

 

Not sure I've worded this the best way possible! 😃 

Categories:
I have the same question (0)
  • victorcp Profile Picture
    2,350 Moderator on at

    Hello!

    Let me show you how I do it and hope it helps you 🙂

    In the component button button, set a variable (vTeste in my case) to true/false:

    victorcp_0-1694690096785.png

     

    Select the component (1), create a custom property (vBoolean in my case) (2) and set this new property as the variable you created in the previous step (vTeste) (3) (4)

    victorcp_1-1694690180977.png

    back to your App, add your component and you can get the information using the '<name of the component>.<name of the property>' in my case Component1.vBoolean

    victorcp_2-1694690454751.png

     

     

  • JeremyGibbs Profile Picture
    on at

    Thanks @victorcp 

     

    I'll try give a bit more context!

     

    This is my Component, I have 4 custom properties - 2 are input fields for the title and message, this bit works fine.

    JeremyGibbs_0-1694692972528.png

    I show the message box from a button using the following:

    JeremyGibbs_1-1694693303751.png

     

    This allows me to call the message box anywhere in my app and have it show a different message but I need to customise what Yes/No does each time.  In this example No just needs to be Set(VarCancelVisible,false) to just get rid of the message box and Yes needs to do the following to reset the form:

     

    Set(varPostcode, "");
    Reset(cmb_Customer_1);
    Reset(cmb_Product_1);
    Reset(txt_QtyToReturn_1);
    Set(VarCancelVisible,false)

     

    In some cases I only have a single message box on a canvas so I can just set it directly in the YesOnSelect property, but where I need the same message box to do different things I'm after a way to dynamically set the event on the button.

     

     

     

  • victorcp Profile Picture
    2,350 Moderator on at

    I see, so try this:

    First turn on the 'Enhaced component properties' (settings -> upcoming features -> experimental)

    victorcp_2-1694730557949.png

    Create a new Property and select 'Event' under 'Property type'

    victorcp_1-1694730099696.png

    victorcp_0-1694730093498.png

    In this case I created it as vEvent, to call this event inside the component use <component name>.<Event property>()

    victorcp_4-1694731145615.png

    Now, go back to your app, add the component and set the property that you created:

    victorcp_0-1694762684068.png

     

    I hope it helps 🙂

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard