cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Display Field Based on User

I successfully managed to filter the browser gallery by logged on user with this community's help using the follow.

 

 SortByColumns(Filter('Training Check List',Office365Users.MyProfile().DisplayName=Officer.DisplayName),"Title",If(SortDescending1,Descending,Ascending))

How can I do a conditional format on a "Card" or "Field" to hide it? I have 4 or 5 supervisors that will be creating an item that need access to a certain field, but everyone else should not see it or at the very least make it read only. Is that possible. 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

Hi @msmith,

 

Yes, this could be done.

You could change the Visible property of the corresponding DataCard with the code below:

If(User().FullName="UserFulName",true, false)

Or in the following format:

If(User().FullName in ["User Name 1", "User Name 2",....],true, false)

The code would check if the UserName matches the one specified, or within the User Name table, if yes, show the DataCard, otherwise, this data card would be invisible.

By the way, you should also replace

User().FullName

with 

Office365Users.MyProfile().DisplayName

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Advocate II
Advocate II

Another method would be to use the "DisplayMode" property.  If you use "DisplayMode.Edit", the user can view and update the field.  If you use "DisplayMode.View", the user can only view the field and it will not appear grayed out.  If you use "DisplayMode.Disabled", the field will not be able to updated and will appear grayed out.

 

Example:  If(UserName = "Supervisor Name", DisplayMode.Edit, DisplayMode.View)

Confluent

View solution in original post

6 REPLIES 6
Highlighted

Could you explain a bit more of the scenario when you want to hide what?
Highlighted

I have it setup so the number of people will equal how many sign up spots there are. What I do not want is for people to be able to change the number of people. The only people that should be able to change this is the supervisor.

 

PowerAppCapture.jpg

Highlighted

Hi @msmith,

 

Yes, this could be done.

You could change the Visible property of the corresponding DataCard with the code below:

If(User().FullName="UserFulName",true, false)

Or in the following format:

If(User().FullName in ["User Name 1", "User Name 2",....],true, false)

The code would check if the UserName matches the one specified, or within the User Name table, if yes, show the DataCard, otherwise, this data card would be invisible.

By the way, you should also replace

User().FullName

with 

Office365Users.MyProfile().DisplayName

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Advocate II
Advocate II

Another method would be to use the "DisplayMode" property.  If you use "DisplayMode.Edit", the user can view and update the field.  If you use "DisplayMode.View", the user can only view the field and it will not appear grayed out.  If you use "DisplayMode.Disabled", the field will not be able to updated and will appear grayed out.

 

Example:  If(UserName = "Supervisor Name", DisplayMode.Edit, DisplayMode.View)

Confluent

View solution in original post

Highlighted

Both worked for me, fantasic! Thank you!

Highlighted

Hi, Can someone provide me the syntax for how i can pass in the Username with Created By value of the list item?

My scenario is to show the field only to the Manager of the person who created the list item.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,519)