Showing results for 
Search instead for 
Did you mean: 
New Member

Hide command bar buttons based on security role

I have created custom buttons using the Command Bar designer. How do I hide certain buttons from certain security roles using the PowerFx formulas?


I have tried using the Ribbon Workbench XRM tool but when I load the solutions, these custom buttons are not showing in RIbbon Workbench.


So I guess my only option is to use PowerFx formulas on the Command Bar designer to hide buttons depending on the user's role. Can anyone help me work out how to get the user's security roles and hide the button from them?

Resolver II
Resolver II

There are permissions support for this in preview (Permissions support in DataSourceInfo and (new) RecordInfo functions for Dataverse | Microsoft Power...), which did not work well months ago, but probably worth trying again. Examples to try in the visible property of the command bar:

For a table:


For a particular record

If(RecordInfo.DeletePermission ,true,false)
so the user would presumably need the delete role on that record for example (also editPermission and readPermission).
I did just try them out of curiousity and they enter all fine with no red squigglies, but just do not seem to work. Both an admin and normal user either sees or does not see depending on delete role.
Maybe I have cache issues or not quite doing it right, so please try yourself. Just make sure to try with both cases.

Helpful resources

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (6,949)