cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bartek1
Helper II
Helper II

Button visible only for specific users (by email)

Hello,

 

I would like to have a specific button visible only for a particular group of users. I would like to use email addresses as a variable.

So far I have used the following: If(User().Email="user@xxx.com" || User().Email="user2@xxx.com" || ;true;false)

 

Unfortunately, not all users can see it (only the first one). Is there any possibility to for example use excel list and put all email addresses there, and then the button will be visible only for users that are included in Excel?

I need to make this button visible for around 50 users and the app will be used by over 300.

 

Maybe other ideas from your experience?

 

Many thanks,

Bartek

10 REPLIES 10
eka24
Super User III
Super User III

Assuming you have a UserTable, add another column2 for usersGroup. Then put the various groups you want.

In Powerapps, OnStart, Set the variable;

Set(LoggedGroup, LookUp(UserTable, Emailcolumn=User().Email,GroupColumn))

The variable hold the group belonging to the user currently logged in.

 

Then on the Visible of the button you want to hide, put the name of that group that have permission to see example:

If(LoggedGroup=Group1,true,false)

 

Group1 is the group that can view the button

Hope this helps

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

 

@eka24thank you, how do I define group1? My column with email addresses is called email and another one member (where there is "yes"). Only people that should have the access to this button are listed in the excel list.

eka24
Super User III
Super User III

Can you show sample of your table possibly, a screen shot

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24attached

eka24
Super User III
Super User III

Assuming Member is the column that will have yes and no for those who will see or not see the button:


In Powerapps, OnStart, Set the variable;

Set(LoggedGroup, LookUp(UserTable, Email=User().Email,Member))

The variable hold the "yes" if the member column for the user is yes. Same for "no"

 

Then on the Visible of the button you want to hide:

If(LoggedGroup="yes",true,false)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24  now the button does not have an error but my email is included in the list with member as yes, but the button is not visible for me

eka24
Super User III
Super User III

Did you restart the app?

To test whether the variable works, Insert a textbox and on Default put: LoggedGroup

Now check the what comes up in the textbox whether "Yes" or "yes" or Nothing

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

@eka24  it shows "false"

eka24
Super User III
Super User III

Is the email in your table office365 email?

Also apart from "yes", what else do you have in the column "No", only two options?

Am asking because you showed only a line of your table.

Finally can you show a screen shot of the formula you used

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (31,476)