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

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

 

@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

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?

Helpful resources

Announcements
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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,266)