cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AdamGill
Resolver II
Resolver II

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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@AdamGill 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@AdamGill 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you - that worked!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,944)