cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimboSey
Helper V
Helper V

Show/Hide icon based on entry in SP choice column

Afternoon,

 

I have an App whereby there are two levels of admin, maintenance, and full access. I have a SharePoint list containing a choices column called Access and the two choices are simply ‘Full Admin’ and ‘Maintenance Only’.

 

I want to set certain icons within my App to only be shown depending on one of the two access permissions.

 

So,  for example if I have a delete icon, that I only want someone with Full Admin access to see, what would I need to put in the Visible property of the icon?

 

Additionally, what would I put in the Visible property of an icon, if I wanted both people with Full Admin Access and Maintenance Only access to see? This would mean only people with those two permissions could see the icon, but any other users wouldn’t.

 

Thanks in advance.

5 REPLIES 5
zmansuri
Super User
Super User

I am assuming you have an email column or person type column in your SharePoint.

 

Write this on App.OnStart:

Set(varUser,User());

Set(IsFAdmin,LookUp(ListName,Email = varUser.Email && Accees.Value = "Full Admin");

Set(IsMAdmin,LookUp(ListName,Email = varUser.Email && Accees.Value = "Maintenance Only");

 

The first variable will store your logged-in user's info.

The second and Third variables will return boolean values meaning True or False.

 

Let's say you have a delete button. Then set this in the delete button's visible property;

IsFAdmin

Because it's a boolean variable you can directly set this in the properties. And if he is the full admin he will see the button.

 

Let's say there is a button which you want to show only Maintainance admin then set this in the visible property:

 

IsFAdmin || IsMAdmin

 

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


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

@zmansuri thanks for your reply, sadly this didnt seem to work.

 

I didnt have an email column in my list so I created one, called it email and added all emails into the list.

 

When I put an icon on the screen and set visible to IsFAdmin it gives the red error.

Share photos of your list and your app code

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


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

Hi, here is the existing code in the onstart of the App.

 

image001 (1).jpg

The SP list, it literally three columns,’ Name’ (single line of text), UserEmail (single line of text) and Access ‘Choice column’

 

 

Thanks again

Set(IsFAdmin,LookUp(ListName,Email = varUser.Email && Accees.Value = "Full Admin");

Set(IsMAdmin,LookUp(ListName,Email = varUser.Email && Accees.Value = "Maintenance Only");

 

Where are this two lines?

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


Was I helpful? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. It will help other users to find it faster.

follow me on Twitter @zmansuri123,
connect with me on LinkedIn from Here

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,655)