web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Hide command bar butto...
Power Apps
Suggested Answer

Hide command bar buttons based on security role

(2) ShareShare
ReportReport
Posted on by 8

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?

Categories:
I have the same question (0)
  • mjburley Profile Picture
    370 on at

    There are permissions support for this in preview (Permissions support in DataSourceInfo and (new) RecordInfo functions for Dataverse | Microsoft Power Apps), 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:

    If(DataSourceInfo.CreatePermission,true,false)
     

    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.
  • shameervalappil Profile Picture
    22 on at

    Thanks for the clue.. I made it work with minor modification to your formula as below;

     

    RecordInfo(Self.Selected.Item,RecordInfo.EditPermission) -  On command Bar Visible property

  • moasmar Profile Picture
    24 on at
    @mjburley Thank you this worked, but after checking the docs, it should be used in this format:
    RecordInfo( First(Accounts), RecordInfo.EditPermission )
    because initially I was using only RecordInfo.EditPermission then it stopped working properly. 
  • Suggested answer
    CU24011632-0 Profile Picture
    4 on at
    Hi,
     
    I can give you a hand up via an example. My goal is to allow the people with my ABC App Admin security role to see the 'Activate' ribbon button only.
     
    Inside the ribbon button editor of the App designer, since it can check if the current user has the permission to delete table records using power FX expressions on the top and it's the only difference between the admin role and user role (in my case), I can only show the activate button to those who has the permission to delete records. FX formula: Visible = If(DataSourceInfo('Your Table', DataSourceInfo.DeletePermission), true, false)
     
     
    Regards,

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard