web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Display Field Based on...
Power Apps
Answered

Display Field Based on User

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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. 

Categories:
  • Rebetcha Profile Picture
    645 on at
    Could you explain a bit more of the scenario when you want to hide what?
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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

  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    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

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Both worked for me, fantasic! Thank you!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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.

  • Tibby Profile Picture
    6 on at

    HI

    Within the DetailScreen1, I wish to disable and hide the trash can unless its your own record (cannot delete someone elses).

     

    I have tried these commands (1 & 2 above) but with no success.  Can you assist please? Thx Tim

     

     

     

  • Tibby Profile Picture
    6 on at

    I worked it out.

     

    I have a field called Person, in that field is User().Fullname, to auto populate the persons name who is using the app.

    This data is actually text.  So to hide the trash can icon, its Visible attribute needs to be:

    If(PersonDataCard.Text=User().FullName, true)

    The trash can is only visible and enabled for deleting your own records.

    I hope this helps others, I should have known better, it was text the whole time!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 396 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard