How to show or hide ribbon buttons using Power Fx formula?

Introduction

I recently found out that we can add or edit ribbon buttons/command bar in PowerApps itself.

https://nebulaaitsolutions.com/add-ribbon-buttons-and-edit-command-bar-within-power-apps-dynamics-365/

I had the habit of customizing ribbon buttons using ribbon workbench, but this time I thought of doing it in PowerApps itself.

I found out that in PowerApps we have to use Power Fx formula for determining the visibility of ribbon buttons.

Solution

After a bit of research I could build this formula.

If(Self.Selected.Item.Status = ‘Status (Marketing Requests)’.Active, true, false)

Example

I have created two buttons ‘Approve‘ and ‘Reject‘ which will be hidden when the status of the record is Inactive.

Click on the button and a command panel will open in left hand side.

Scroll down in the command panel until you find ‘Visibility‘ option and select ‘show on condition formula‘. Add this formula in the textbox which has fx as a label and then click on ‘Save and Publish

If(Self.Selected.Item.Status = ‘Status (Marketing Requests)’.Active, true, false)

After publishing we can see that the buttons are not visible when the record is inactive.

View Comments