Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Field Specific Security Using Sharepoint List

Posted on by 20

I am very new to power apps. My knowledge consists of watching a multitude youtube videos.

General Problem:

I have 2 groups of users (recruiters and administration). The recruiters fill out half the fields on a sharepoint list but view all of the fields. Administration fills out the other half and views all fields. I have the main sharepoint list and a separate lookup list of person roles.

I have built the power apps forms. I need to limit the editability of half the fields from the recruiters. Since sharepoint doesn’t allow column specific security I thought I would try making each field that shouldn’t be edited by the recruiters to be displaymode.view only.

My solution so far:

I am trying to base this off of the sharepoint person role list. Basically, trying to check the list to see if the user name/email is associated with an administration role. If it is an Administration role then displaymode.edit, else displaymode.view. I could then paste this into each field they shouldn’t have access to edit.

I can’t seem to get it to work. Can someone check my if statement and see what I’m doing wrong? To be honest I’m not sure if this approach will even work. Any suggestions are welcome.

Formula:

DisplayMode = If(lookup(‘lkuppersonrole’, user().email = !is blank), if(lookup(‘lkuppersonrole’, role.value= "Administration"), displaymode.edit,), displaymode.view)

 

Hopefully I’m making sense.

  • Nick555 Profile Picture
    Nick555 20 on at
    Re: Field Specific Security Using Sharepoint List
    With your help I figured it out!!! Very much appreciated. I re-did the email column in the list from scratch and things fell into place!
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 143,246 on at
    Re: Field Specific Security Using Sharepoint List

    @Nick555 ,

    Then there is your problem - you need to compare the field with the user's email in it with the current user.

  • Nick555 Profile Picture
    Nick555 20 on at
    Re: Field Specific Security Using Sharepoint List

    Doesn't seem to return anything.

    Nick555_0-1681947920051.png

     

  • WarrenBelz Profile Picture
    WarrenBelz 143,246 on at
    Re: Field Specific Security Using Sharepoint List

    @Nick555 ,

    Put this on a Label and see what it returns

    LookUp(
     LkUpRecruiter, 
     Title = User().Email
    ).Role

     

  • Nick555 Profile Picture
    Nick555 20 on at
    Re: Field Specific Security Using Sharepoint List

    You are correct, I futzed with the structure it changed the fields to text to try and make it work. Very much appreciated that you sent the correct code for the text version.

     

    It now accepts the formula and I am not getting any red x’s but it doesn’t seem to work security wise. It is making the field  read only now for everyone. Thoughts?

    Nick555_0-1681944367725.png

     

  • WarrenBelz Profile Picture
    WarrenBelz 143,246 on at
    Re: Field Specific Security Using Sharepoint List

    @Nick555 ,

    The structure is valid assuming Title contains the user's email and Role is a Choice or a Lookup field (I got this from your posted code). If it is Text, just use Role, not Role.Value

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Nick555 Profile Picture
    Nick555 20 on at
    Re: Field Specific Security Using Sharepoint List

    I tried this but it doesn't seem to be working. I've been monkeying with it but can't seem to get it to work. Both fields are single line text so I'm not sure why it says they are incompatible.

    Nick555_1-1681752913990.png

     

  • WarrenBelz Profile Picture
    WarrenBelz 143,246 on at
    Re: Field Specific Security Using Sharepoint List

    Hi @Nick555 ,

    Try this

    If(
     LookUp(
     ‘lkuppersonrole’, 
     YourPersonField.DisplayName = User().Email
     ).Role.Value = "Administration", 
     DisplayMode.Edit,
     DisplayMode.View
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard