Security Trimming Buttons and Fields in Power Apps.
- Jeremiah
- Nov 8, 2020
- 1 min read
This is one of the frequently asked question that comes in how to trim parts of my Power App to only allow certain users to see the data or a button. You can do this through code in the Power App but then every time that needs updated you are having to go into the app edit the code and republish the app.
The other option is what I suggest you will need a SharePoint Online list lets call it “Security” only one column is required and that’s the Title column. In the column you will enter the email address of the user that needs access. This way if you need to add someone or remove them its all in the list and no editing to the Power App.
Here is what you will need to do to make this work.
First on App start create the following variable: Set(varUserEmail, User().Email), this sets varUserEmail as the logged in users email.
Now select the button or field that you want to security trim visible property.
You will need to add this: !IsBlank(LookUp(“Supply_Delete_Sec”, Title = varUserEmail).Title)
Breaking this down !IsBlank says this is not blank, then we lookup(YourList, Title = your varible).Title gives the text of that field. That is how we determine to show the button or field.
Comments