cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yellowjacket9
New Member

Using PowerApps to Lock Down Edit Permissions on SharePoint List

I am trying to use PowerApps to make a custom form that restricts edit permissions for a few scenarios. I am very new to PowerApps so I apologize if I'm making any silly mistakes.

The scenarios I am trying to account for:

  • If an item on the list has been marked as 'Completed' in the status column, only members of my team can edit the item.
  • If you are not a member of my team, you cannot edit items that you yourself did not create.

Attached is my code on the display mode for each entry of the form. 'varFormOnEditMode' is simply a variable to see if the user is in edit mode. 'varIsAdmin' is linked to another list that contains the members of my team. 

Currently, the first line of the IF statement regarding the status seems to be working properly. The second line however, worked last week but without making any changes, it is no longer working. Any help would be greatly appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions

Gotcha, where are you setting your varFormOnEditMode variable? Can you just set that to the same thing when the user is starting a new form? Find this by selecting the SharePointIntegration on the left panel, then in the property dropdown you should see OnNew, OnEdit, OnSave...

 

fatjosh35_0-1657052575328.png

 

View solution in original post

8 REPLIES 8
fatjosh35
Helper I
Helper I

Can you explain reasoning behind the Now() < ThisItem.Created piece of the condition? I feel this might be part of the issue.

Right, so if you take away that piece of the condition, it made it so I could no longer edit the fields while creating a new item. This was a sort of ugly workaround to avoid that.

Could you instead add an additional Or statement to your condition? Saying if form1.DisplayMode="new", keep fields in Edit. 

 

If(

  And(varFormOnEditMode, !varIsAdmin, ThisItem.Status.Value = "Completed") ||

  And(varFormOnEditMode, !varIsAdmin, User().Email <> ThisItem.Author.Email) ||

  form1.DisplayMode <> "new",

  View,

  Edit

)

 

OR something like this

 

If(

  And(varFormOnEditMode, !varIsAdmin, ThisItem.Status.Value = "Completed") ||

  And(varFormOnEditMode, !varIsAdmin, User().Email <> ThisItem.Author.Email, form1.DisplayMode <> "new"),

  View,

  Edit

)

Thank you for the suggestion. When I tried it, both scenarios seem to be covered but I can no longer edit the fields when creating a new item. I do think this is a step in the right direction though.

When creating a new item is there a form going into edit mode or new mode? or maybe a variable being set? Essentially what is the OnSelect property of the "New Item" button?

I'm sorry, could you explain how I can check? I doing this as an integrated PowerApp.

Gotcha, where are you setting your varFormOnEditMode variable? Can you just set that to the same thing when the user is starting a new form? Find this by selecting the SharePointIntegration on the left panel, then in the property dropdown you should see OnNew, OnEdit, OnSave...

 

fatjosh35_0-1657052575328.png

 

It seems I had accidently set the DisplayMode to EditMode while "OnNew". Thank you so much for your help!

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 (3,132)