cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Manny123
Helper III
Helper III

how to make an Icon visible to ONLY some selected users

Hi Team,

 

I was wondering if anyone can help.

I have a simple Powerapps gallery which is connected to a SharePoint List.  The Gallery allows team members to Answer IT questions raised from employees. 

The Gallery also has a "Delete" icon for each item which is supposed to be only visible for some of the senior team members, so they could delete a question from the gallery..

However I cannot get the Delete Icon to work for the senior team members. It works for me though.

On the "DisplayMode" of the Delete icon - I have used the following code: 

If(User().Email="myemail@workemail.com" Or "Senior1@workemail.com" Or Senior2@workemail.com" Or  "Senior3@workemail.com",  DisplayMode.Edit,DisplayMode.View)

 

I don't know what I am doing wrong. The delete icon works perfectly for me but the senior team members they cannot click on the icon. They can see it but nothing else.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
AmDev
Super User
Super User

Hi @Manny123 

 

Please try:

 

If(User().Email="myemail@workemail.com" Or User().Email="Senior1@workemail.com" Or User().Email=Senior2@workemail.com" Or  User().Email="Senior3@workemail.com",  DisplayMode.Edit,DisplayMode.View)

 

 

View solution in original post

5 REPLIES 5
AmDev
Super User
Super User

Hi @Manny123 

 

Please try:

 

If(User().Email="myemail@workemail.com" Or User().Email="Senior1@workemail.com" Or User().Email=Senior2@workemail.com" Or  User().Email="Senior3@workemail.com",  DisplayMode.Edit,DisplayMode.View)

 

 

zmorek
Super User
Super User

Does their email exactly match whatever you typed in your formula? If its capitalization is different than how you have it, it won't work for them. Also you missed a quotation by Senior2@workemail.com, but that could just be because you were giving us examples.

timl
Super User
Super User

@Manny123 

An alternative is to use the in function like so:

 

 

If(User().Email in ["myemail@workemail.com","Senior1@workemail.com","Senior2@workemail.com","Senior3@workemail.com"],  
  DisplayMode.Edit,
  DisplayMode.View
)

 

If capitalization is an issue, you can specify everything in lower case like so:

 

If(Lower(User().Email) in ["myemail@workemail.com","senior1@workemail.com","senior2@workemail.com","senior3@workemail.com"],  
  DisplayMode.Edit,
  DisplayMode.View
)

 

 

 

 

Thanks. This also works and can be used too! Well done.

AmDev
Super User
Super User

Hi @Manny123 

 

Glad that worked out for you!

 

One thing to note, if you will need to change the permissions to this button due to staff turnover, this will involve going in to edit your app each time and changing what is effectively hardcoded info - and you will need to republish the app each time you do this.

 

If you want to manage this list of people dynamically directly from within the app, you could set up a simple SharePoint list with these users in a person column adn then add something like the following in the visibility property of the delete icon.

 

!IsBlank(LookUp(PermissionsList, UserColumn.Email = User().Email))

 

Then add a simple admin screen in your app with gallery and form side by side to manage the permissions list with sample add/delete options - obviously you also want to limit access to that screen, so just use the same formula from above for the icon that will navigate users to that area.

 

Appreciate it's not the question you asked, but thought I would share it with you in case you find the concept useful for this or a future app.

 

Good luck with the rest of your build!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,902)