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 / Show/Hide Button based...
Power Apps
Answered

Show/Hide Button based on User Email Address for multiple different Users

(0) ShareShare
ReportReport
Posted on by

I have a Button that I only want to show for particular users within the organization. I have the following set up on the "Visible" Property of the Button:

If(Lower(User().Email)="user1@microsoft.com"||"user2@microsoft.com"||"user3@microsoft.com"||"user4@microsoft.com || "user5@microsoft.com" || "user6@microsoft.com" || "user7@microsoft.com",true,false)

I have also tried:

  • Setting up the User Email Address on App StartUp, defined as "UserEmailAddress" and using the Text results of that parameter in the same way.
  • Adding a Field on the form which shows the logged-in UserID's email address and using the Text result of that parameter in the same way.

However none of these scenarios are working and I cannot determine a root cause for this,. Any pointers would be greatly appreciated - Thanks!

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    You cannot OR on multiple value like that.  Each must be a complete or of User email to value.

     

    You will have much better control in your app if you do the following:

    Instead of doing this in the Visible property (and potentially the visible property of many other controls).  Set a global variable in your OnStart like this:

    Set(glbAdmin, 
     Lower(User().Email) in 
     "user1@microsoft.com|user2@microsoft.com|user3@microsoft.com|user4@microsoft.com|user5@microsoft.com|user6@microsoft.com|user7@microsoft.com"
    )

    Note, the difference here from your formula is that all of the emails are put together in one string.  The in operator is used to determine if the lower case email of the user is in that string.  If so, then the entire formula will resolve to true, and thus glbAdmin will be true.

     

    Now, in your Visible property simply put this: glbAdmin

     

    There is nothing else needed.

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    on at

    Thank you - that worked!

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard