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 ,
Then there is your problem - you need to compare the field with the user's email in it with the current user.
Doesn't seem to return anything.
@Nick555 ,
Put this on a Label and see what it returns
LookUp(
LkUpRecruiter,
Title = User().Email
).Role
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 ,
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
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.
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.