Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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! 😃 

  • victorcp Profile Picture
    2,347 Super User 2025 Season 1 on at
    Re: Dynamic Message Box

    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 🙂

     

  • JeremyGibbs Profile Picture
    on at
    Re: Dynamic Message Box

    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,347 Super User 2025 Season 1 on at
    Re: Dynamic Message Box

    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

     

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard