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 / Trying to protect a fi...
Power Apps
Unanswered

Trying to protect a field from update unless it is one of two roles

(0) ShareShare
ReportReport
Posted on by 6

Hello, 

 

In Power Apps I'm trying to make a field display only unless the user's email address is in one of two roles (Chair, Chair's deputy). I've tried different variations of code in the DisplayMode box for the field, but I can't get any of them to work. This is what I've got at the moment. I've also tried using the corresponding datacard values for those details, but that hasn't worked either. Any tips would be appreciated. 

 

If(Or(User().Email=ThisItem.'Chair',User().Email=ThisItem.'Chair''s deputy'),DisplayMode.Edit,DisplayMode.Disabled)     

If(Or(User().Email=DataCardValue29.Selected.Value),(User().Email=DataCardValue9.Selected.Value)),DisplayMode.Edit,DisplayMode.View)

Categories:
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @JacquiB,

    Do you mean that enabling a field based on role?

    Could you please tell me that what id the Chair, Chair's deputy, different columns saving user email address? Both Text type?

     

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @JacquiB ,

    Firstly, I suggest you rename the field 'Chair's Deputy' or use Chair_x0027_s_x0020_Deputy as a single quote can be problematic in a field name, However, can I assume that those two fields in the current record contain the email addresses of those two people ?

  • JacquiB Profile Picture
    6 on at

    Thanks, I'll try that. Yes, they're both email addresses.

     

  • JacquiB Profile Picture
    6 on at

    Hi, yes they're both text and they hold email addresses of the people with those roles. 

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @JacquiB ,

    If they are both potentially matching email addresses in Text fields, then this should work. I am assuming your data source is SharePoint ?

    If(
     ThisItem.Chair = User().Email ||
     ThisItem.Chair_x0027_s_x0020_deputy = User().Email,
     DisplayMode.Edit,
     DisplayMode.Disabled
    ) 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

      

  • JacquiB Profile Picture
    6 on at

    Thanks. If || means 'or', what should I use for 'and' in another if statement that I'm using?  

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @JacquiB ,

    Yes || is Or() - just saves a set of brackets and is a bit neater. && is And() - you can use either, but I tend not to mix the different styles.

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 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard