{Step by Step} Add Show/Hide visibility rule using Power Fx to a Command button using new Command designer

In continuation of my previous articles where we were exploring how to use the new Command designer, today we will learn how to apply show and hide rule using Power Fx in the new command designer.

Part 1: How to create a button:

{Step by Step}Create Command button in Power Apps using command designer

Part 2: How to apply a Power FX command using Command designer: https://dynamicsofdynamicscrm.com/2022/08/04/step-by-stepadd-power-fx-commands-on-a-command-button-using-command-designer/

In last article we had already created a button named as “Entity Details.”

Now let us apply show and hide rule to the button!

Formula

Select the button “Entity Details”, click On Visible property and apply below formulae:          If(CountRows(Self.Selected.AllItems) > 0,true , false)

Based on this formulae, if at least one row of data is selected, button will be visible. Else, it will be invisible.

Please refer screenshot below:

As seen in below screenshot, command button is visible only when at least one contact is selected:

Tip: Sometimes the change on button does not reflect instantaneously, so you might need to refresh the page two to three times!

Now let us see the button visibility when no contact is selected:

Hope it helps!

Power 365ing as usual!

Any problem in Power Platform or Dynamics 365 – end user, Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Me and my team are here to assist, please fill the following form for your business needs: Click here

About the Author: