cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Priyasantra
Microsoft
Microsoft

How to change the displaymode of a button based on sharepoint list user based

Hi, I need a help for my onboarding application I have created an Onboarding application as shown in the below screenshot There are 4 buttons at the left handside 1. New Onboard 2. My Training 3.Intro Connect 4. Process Training When the "New Onboard" is clicked it gives a pop up with a form as shown below Priyasantra_0-1606495205257.png Now my requirement is--> I have a share point list "Access Control" and in this list I have 2 columns:-

 

1. User (Person/Group column)

2. Roles (Choice)

Priyasantra_0-1612427086728.png

 

 

I want that the Dispalymode.Edit of this button should be true only for the the users those have their roles as "Admin" in the "Access Control list". Which means the users in the list with "Admin" as the role when clicks on the button should get this popup. Anyone apart from the admins should not be able to click this. They should only be able to view this and not edit. Please help me to set this code.

 

I used to achieve this by using the below formula in the Display mode of the button but the below formula no longer works 

 

With({usrRoles: LookUp('Access Control Admins', User().Email=User().Email, Roles)},

If("Admin" in usrRoles.Value, DisplayMode.Edit, DisplayMode.View)

)

 

Thanks in advance Regards Priya

1 ACCEPTED SOLUTION

Accepted Solutions

Hi@

Could you please check my formula again, I refer to the Users column in your 'Access Control Admins' list rather than the User() function.

It should be Users.Email = User().Email.

If(
    LookUp(
        'Access Control Admins',
        Users.Email = User().Email, // Please notice this line.
        Roles
    ) = "Admin",
    Edit,
    View
)

Regards,

Qi

Best Regards,
Qi

View solution in original post

3 REPLIES 3
v-qiaqi-msft
Community Support
Community Support

Hi@

 

If(
    LookUp(
        'Access Control Admins',
        Users.Email = User().Email,
        Roles
    ) = "Admin",
    Edit,
    View
)

 

Regards,

Qi

Best Regards,
Qi

Hi @v-qiaqi-msft 

 

No the user  column is not a multiple selection.  And using the above formula gives error. Please see attached

Priyasantra_0-1612430430400.png

Regards

Priya

Hi@

Could you please check my formula again, I refer to the Users column in your 'Access Control Admins' list rather than the User() function.

It should be Users.Email = User().Email.

If(
    LookUp(
        'Access Control Admins',
        Users.Email = User().Email, // Please notice this line.
        Roles
    ) = "Admin",
    Edit,
    View
)

Regards,

Qi

Best Regards,
Qi

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,407)