cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LT91
Frequent Visitor

Restricting the editing and deleting of items

Hi

 

I'm currently building an app that manages inventory within a lab and there is a need to restrict who can edit and delete items to the person who is listed as responsible, their line manager and people who are 'super users'.

 

To control who can edit and delete, I would like base it off of the following depending on who is logged in to the app. I know this won't affect people's ability to go into the sharepoint list and edit but that's not really a concern. I have the following 2 fields in place that are people pickers:

 

1. 'Person Responsible'

2. 'Line Manager'

There is also then a seperate list that contains people who are super users and that is connected to the app too.

 

Effectively, I'm trying to make it so that the 2 buttons below don't appear to anyone for the item unless they are listed as the person responsible or line manager within the item, or they are on the super user list.

 

Capture.PNG

 

What would be the best way to go about this?

2 REPLIES 2
RandyHayes
Super User
Super User

@LT91 

Assuming that you are getting to this page from a Gallery and that in that Gallery you are setting some sort of variable to be used for your form screen, then you can utilize the following for the DisplayMode property of those icons.

 

With({_user:Lower(User().Email)},

    If(Lower(yourRecordVariable.'Person Responsible'.Email) = _user ||
       Lower(yourRecordVariable.'LineManager'.Email) = _user,

       Disabled,
       Edit
    )
)

 

You only need this in one of the icon DeisplayMode properties and then the other can reference that one.  Example, you put this in the Edit icon DisplayMode, then you can set the DisplayMode property of the Delete icon to yourEditIcon.DisplayMode

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
LT91
Frequent Visitor

@RandyHayes 

Thanks for the help.

 

I am navigating to this screen from a Gallery, but what do you mean by variable for the form screen? Just to put it into context.

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,426)