cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tested1
Level: Powered On

Re: PowerApps Form - Hiding fields from certain Users

hi @Anonymous 

 

Sorry for the late reply. How do I do step 9 or where/what do I write on the data card?

 9. Then you can bind your fields visibility to isAdmin 

 

Sorry about the picture. I have uploaded some more pics in one below. Im not sure what the error is. Maybe after I bind it? 

Thank you, once again.

mmm.png

Super User
Super User

Re: PowerApps Form - Hiding fields from certain Users

@tested1 

Keep in mind with all of this that you are creating security through obscurity.  The fact will still remain that if a user can edit columns of a SharePoint list, they can edit them all.  The fact that you Hide a field from users in PowerApps does not preclude that they can't still get to the information directly in the SharePoint list.  Just wanted to make sure that was aware.

 

Now, the suggestion that @Anonymous suggests is pretty much spot-on.   If you want to control the visibility of a DataCard you can do so with the Visible property of the DataCard.

1) The super simple - Visible(User().Email="someone@xxx.com")  only that person will see the datacard.

 

2) The more flexible but more complex - Create a Role/Access (Access Control List - ACL) in SharePoint and provide names and roles there that can access. I will state one of the processes I use often for this...

Step 1 - Create a SharePoint list for your ACL

   Call it what you want (I'm calling it AppACL in this scenario) and put it wherever you want.  I'd recommend that general users ONLY have read access to the list - they must have at least that permission.

Step 2 - Put the following Columns in the SharePoint AppACL list (as an example - you can add other columns for other aspects of the role):

   UserEmail Text Column (you can rename Title to this if you want, just remember it is still technically "Title")

   HasManagerRole - A Yes/No column

Step 3 - Add a record (or more) in the SharePoint AppACL list with the email address of the people you want to have access.  Set the HasManagerRole to Yes for them.  (By nature of this solution, you don't have to add people who would NOT have a manager role, only those that do).

Step 4 - In your PowerApps app, create a connection to the AppACL list.

Step 5 - In your OnStart (best place for it, but you can do elsewhere if necessary) place the following Formula:

Set(MyACLprofile, Lookup(AppACL, Title = User().Email))  //remember from above if you renamed Title to UserEmail, it's still title.  If you added another column for the email address, then use that instead of Title

Step 6 - Anywhere you want to control a property based on the permission in the ACL, use the formula:

   MyACLprofile.HasManagerRole

So, for your needs, on the DataCard for the field you want to hide from everyone except those with access, set the Visible property to (MyACLprofile.HasManagerRole)

 

That's all there is.  You can now control the datacard visibility (and any other control you set this on) from your SharePoint ACL list.

 

Hope this helps clear it up.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Anonymous
Not applicable

Re: PowerApps Form - Hiding fields from certain Users

1. your error results from the last semicolon in your App.Onstart

2. you have to write your variable isAdmin to the property called Visible of your datacard

tested1
Level: Powered On

Re: PowerApps Form - Hiding fields from certain Users

Thanks! @RandyHayes  and @Anonymous  for continual help

 

Quick Question.

 

Does this warning matter? Or anyting else look weird?

 

myacl.png

Super User
Super User

Re: PowerApps Form - Hiding fields from certain Users

@tested1 

This is a standard Delegation warning.  The formula you have is not delegable on the DataSource.  When you see these warnings you have to take note and consideration of the potential size of your list.

If your list will be relatively small and will never grow to thousands of records, you can ignore the warning. 

In this case of an ACL list, you probably will never grow the list that large and you can safely ignore it.

In other cases, you need to plan for delegation issues...which is a whole other topic that has many postings about on this forum.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
IanHudson
Level: Powered On

Re: PowerApps Form - Hiding fields from certain Users

what about the red squiggly under the = 

I am getting that too and it says it's an invalid argument type

Thanks,
Ian Hudson
tested1
Level: Powered On

Re: PowerApps Form - Hiding fields from certain Users

hello @IanHudson 

 

the formula should be 'UserEmail.Email = User().Email))'  This fixed the error for me 🙂

IanHudson
Level: Powered On

Re: PowerApps Form - Hiding fields from certain Users

thanks so much! that made the error go away, but I am not having luck with it working. I am trying to use this to make the displaymode edit or view.....it will only view. I think it's not seeing the list,

Not sure what I am missing. here are my formulas

on start: Set(MyACLprofile, LookUp('Lead Producer', Presence.Email = User().Email))

Displaymode: If(MyACLprofile.HasManagerRole,DisplayMode.Edit,DisplayMode.View)

 

the list is called Lead Producer and the column is calle Presense.......hmmmmm....what am I missing here?


@tested1 wrote:

hello @IanHudson 

 

the formula should be 'UserEmail.Email = User().Email))'  This fixed the error for me 🙂


 

Thanks,
Ian Hudson
Super User
Super User

Re: PowerApps Form - Hiding fields from certain Users

@IanHudson 

If it's always View mode, that means that your If statement is always False.  So, there are one of two issues - either there is a problem with the Formula where you lookup, or there is an issue with the Datasource record.

 

So, easy one first...verify in your DataSource that you really have the HasManagerRole set to Yes.

Next, try putting a label in your App somewhere and set its text propery to:

  MyACLprofile.HasManagerRole

With that you will see the exact value that is coming back through your lookup.

 

See if that helps identify the issue for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
IanHudson
Level: Powered On

Re: PowerApps Form - Hiding fields from certain Users

Thanks and a great idea! - I created the text box and it shows false regardless of whether make the "HasManagerField" field yes or no.... so something is wrong with my formula. It is always false.

here is my forula

Set(MyACLprofile, LookUp('Lead Producer', Email = User().Email))

 

Lead Producer is the list name

Email is the text field where I have my email

I have tested that user().email returns my email , so they are equal.

 

not sure what I am missing - I have permissions to vies the Lead Producer list....everyone does.....

 

thanks for all your help - I know I'll get this eventually. any more help would be greatly appreciated though 🙂

Thanks,
Ian Hudson

Helpful resources

Announcements
thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (4,762)