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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,498)