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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Model Driven Apps Use ...
Power Apps
Unanswered

Model Driven Apps Use Command Bar to change custom button visibility

(0) ShareShare
ReportReport
Posted on by

Hello all!

 

I am building a model-driven app and was playing with the command bar to create a custom button. It's a really nice feature and the Action/OnSelect action seems to be working fine, however the Visibility/Visible formula doesn't work.

 

I tried this in a canvas app and it works fine. I am checking to see if the logged in user has the "System Administrator" security role assigned to them. If it does, then show the button otherwise hide it.

 

If(
   CountRows(
      Filter(
         LookUp(Users,domainname =User().Email).'Security Roles (systemuserroles_association)'
           ,Name="System Administrator"))>0
   ,true,false)


I lookup the logged in user record in the "User" table, access the relationship table between User-Security Role called "systemuserroles_association" to see all the related security roles to the user which returns a table. Then I filter that table on the Name of the security role to be "System Administrator" and count the rows to check if it has more than 0. It should have one row if the user has "System Administrator" which then makes the condition true.
 
Any other advice on how to achieve this? I cannot put any JavaScript in the Visibility formula either.
 
I was thinking of creating the button with the Ribbon Workbench but that might have issues of its own.
 
Thank you!
 
Categories:

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard