How to Show and Hide Buttons in Dynamics 365 Using Power FX in Power Apps

By Ron Ellison | October 2, 2024

If you want to display different command bar buttons on a form depending on specific criteria, you can use the Power Fx button Visibility section to show or hide a button using the Formula bar.

In my real-life example, I wanted to replace the out-of-the-box Create Order button with a warning when shipping information was required.

  1. In Dynamics 365, browse to https://make.powerapps.com
  2. Click Solutions on the left side menu
  3. Create a new solution and add the App you want to customize (for example: Sales Hub)
  4. Click the App Display Name to open the App Page.
    App Display Name
  5. On the left side pages, find the table you want to update (in my example I am scrolling to Quotes)
  6. Click the “…” to the right of the view and click the Edit command bar
    Edit command bar
  7. Choose the Command Bar you want to edit (in my example I am updating the Main Form)
    Edit main form
  8. Click Edit
  9. Add a new button that you want to display in place of the out-of-the-box button
  10. Click the out of the box button from the view of buttons (NOTE: You might have to recreate the out-of-the-box button and hide the original button from Ribbon Workbench if you don’t see the button in the view)
  11. On the right-side panel, in the section called Visibility, change to Show on condition from formula.
    show on condition from formula
  12. Click Open formula bar
  13. In the top fx box type the following command:
    1. If(Self.Selected.Item.schemaname = true And Self.Selected.Item.statecode = 1, true, false)
      1. Example: Option Set Yes/No field options (Yes= true and No=false)
        type no yes
      2. Example: Option Set where Option Set value number = 1, 0, et
        option set value
  14. Click the other button and follow the same steps to Show the button on condition from the formula and set the logic to the opposite of the other button.

Want to Learn More Ways to Optimize Your Software Solutions?

Reach out to Stoneridge Software! Our experts can help you refine your solutions so they work optimally for your business.

Related Posts


Under the terms of this license, you are authorized to share and redistribute the content across various mediums, subject to adherence to the specified conditions: you must provide proper attribution to Stoneridge as the original creator in a manner that does not imply their endorsement of your use, the material is to be utilized solely for non-commercial purposes, and alterations, modifications, or derivative works based on the original material are strictly prohibited.

Responsibility rests with the licensee to ensure that their use of the material does not violate any other rights.

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!