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 / Is it possible to rest...
Power Apps
Unanswered

Is it possible to restrict editing based on an email column and text column from another list?

(0) ShareShare
ReportReport
Posted on by 41

Hello,

 

I have three SharePoint Lists. For one of them ("Locker Inventories"), I want to restrict editing or creating on the Power Apps Form for users based on the users "Work Center" value in another list.

 

The "Locker Inventories" App is looking at this list called Coordinators:

coordpalsitlkinv.jpg

 

Below is more background on the lists in case it's needed. I'm willing to change the column types if there's an easier way to do this.

 

  1. Work Centers: Just a list of Divisions and Work Centers. Other Lists use this with lookup columns, but it's not necessarily needed, just convenient. I could use Choice columns instead if Power Apps won't allow it.
  2. Coordinators: Contains -
    • a lookup column called "Work Center" and brings the Division value as an additional field from the Work Centers List
    • an email column
    • A yes or no Column called "Locker Inventory", which will limit Work Center values in the Locker Inventories List.
  3. Locker Inventories: This is the list that I'm having issues with (mainly the second bullet):
    • Only users in the "Coordinators" List can edit or create, but everyone can see.
    • I want users to select their "Work Center" in the same row as their email in the "Coordinators" List (Not multiple select).

 

The main issue I'm having is the formulas to restrict selections based on the "Work Center" Drop Down and the user's email. Again, I'm willing to change the column types. I'd appreciate the assistance if anyone has had to do something like this before.

 

Thanks for your time

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,425 Most Valuable Professional on at

    Hi @Jadarius ,

    I have read this several times and still am a little unclear on exactly who you want to be able to edit the data. This is an an example of only people from a particular division in the record of the user

    With(
     {
     _Data:
     LookUp(
     Coordinators,
     YourEmailField = User().Email
     )
     },
     UpdateContext(
     {varAdmin: _Data.WorkCentre.Value = "YourChosenValue"}
    )

     You would then use varAdmin as the trigger for view or edit mode on the control.

     

    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

  • Jadarius Profile Picture
    41 on at

    Hey @WarrenBelz,

     

    Thanks for the response. My apologies for the confusion, I'm a little new to Power Apps.

     

    Example of what I'm trying to do (Below is the "Coordinators" List):

     

    • John can only edit or create on the Locker Inventories List for 51A, 51C, and 520.
    • Sarah can only edit or create on the Locker Inventories List for 610.
    • Zack can't edit or create anything on the Lockers Inventories List since his "Locker Inventory" field doesn't have a check (yes/no).
    Work CenterEmailLocker Inventory
    51A, 51C, 520John.doe@email☑️
    610Sarah.johnson@email☑️
    81A, 81BZack.Jack@email 

     

    Anyone that isn't in the Coordinators List can of course see the Locker Inventories list, but they can't edit the items, which I've set the permissions for in the actual list.

     

    Here's my version of the formula you provided:

     

    With({_Data: LookUp(Coordinators, Email = User().Email)},UpdateContext({varAdmin:_Data.'Work Center'.Value = "YourChosenValue"}))

     

    It's giving me these errors:

    • Email = User Incompatible Types for comparison. These types can't be compared: Record, Text.
    • },UpdateContext Behavior function in a non-behavior property. You can't use this property to change values elsewhere in the app.
    • UpdateContext({ Expected Table Value.
    • .Value = "YourChosenValue" Incompatible Types for comparison. These types can't be compared: Table, Text.
       

    For setting the VarAdmin as the trigger for the view or edit mode, would I put that in the DisplayMode Property? and what would that look like?

     

    Thanks for your patience and assistance.

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

    @Jadarius ,

    It comes don to where and how you run this, but before we go any further, example referring to a record selected in the Gallery

    With(
     {
     _Data: 
     LookUp(
     Coordinators, 
     Email = User().Email
     )
     },
     UpdateContext(
     {
     varAdmin:
     _Data.'Locker Inventory'.Value &&
     _Data.'Work Center'.Value = Gallery.Selected.'Work Centre'
     }
     )
    )

    and a couple of other observations on the errors

    • Email = User Incompatible Types for comparison. These types can't be compared: Record, Text.
      This makes no sense if email is a Text field - User().Email is also Text - something is wrong here
    • },UpdateContext Behavior function in a non-behavior property. You can't use this property to change values elsewhere in the app.
      Again makes no sense - it is a simply setting of a Variable - where are you running this from ?
    • UpdateContext({ Expected Table Value.
      Table value for what ?
    • .Value = "YourChosenValue" Incompatible Types for comparison. These types can't be compared: Table, Text.
      What did you put for your chosen value ?
       
      Can you please post the actual code you are using (in Text) and where you are using it.
  • Jadarius Profile Picture
    41 on at

    @WarrenBelz,

    I don't have a gallery, just a form to edit the Locker Inventories list.

     

    For the errors:

    Here is my email field inside the Coordinators List

    EmailField.JPG

     

    I inserted the formula you gave me into the items property of the Work Center Drop Down.

    WCddPA.JPG

     

    I'm assuming it's expecting a table value from the coordinators list.

     

    And I didn't choose any value. I just added the formula. When I click on the work center drop down, it doesn't show any values. My apologies if it sounded like I had a gallery.

     

    Also, my work center column in the coordinators list is a lookup column to a list called "work centers" (in case that matters)

     

    Is this the code you're talking about? 

    With({_Data: LookUp(Coordinators, Email = User().Email)},UpdateContext({varAdmin:_Data.'Work Center'.Value = "YourChosenValue"}))
     
     
    Thanks.
  • WarrenBelz Profile Picture
    156,425 Most Valuable Professional on at

    @Jadarius ,

    Yes - you cannot use that as the Items of a dropdown, it is a trigger for the setting of a Variable and needs to be run possibly OnChange of the drop-down. The Items of a drop-down only determine what values are displayed in it. Also your EMail field is a Person field, not Text and is going to be very confusing as you need Email.EMail. The Items of the drop-down need to display the work centres available (probably 

    Choices(Coordinators.'Work Centre')

    and setting your Variable OnChange of the drop-down would be something like

    With(
     {
     _Data: 
     LookUp(
     Coordinators, 
     Email.Email = User().Email
     )
     },
     UpdateContext(
     {
     varAdmin:
     _Data.'Locker Inventory'.Value &&
     _Data.'Work Center'.Value in Self.Selected.Value
     }
     )
    )

    Before you come back. please take a moment to understand what this code is doing.

  • Jadarius Profile Picture
    41 on at

    Hey @WarrenBelz,

     

    Thanks. I understand this a little more now. After researching, I can't figure out why it's giving me an error for the "Value".

     

    Below is the code for the OnChange variable:

    WCDrpDwn.JPG

    .Value Invalid use of '.'  ('Locker Inventory'.Value)

    .Value Invalid argument type. Cannot use table types in this context. ('Work Center'.Value)

     

    I'm not sure why it's not working. I know it should be finding the current users email in the email column, then self selects the work center values only if the locker inventory field has a value then varAdmin is the trigger to allow them to select work center values or edit the form. Am I close?

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

    @Jadarius ,

    Exactly what type of fields are 'Locker Inventory' and 'Work Centre' in Coordinators (please post the list setting screenshot)

  • Jadarius Profile Picture
    41 on at

    @WarrenBelz,

    LILISTSETTINGS.JPGWCLISTSETTINGS.JPG

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

    @Jadarius ,

    OK - try this assuming the drop-down is a single selection

    With(
     {
     _Data: 
     LookUp(
     Coordinators, 
     Email.Email = User().Email
     )
     },
     UpdateContext(
     {
     varAdmin:
     _Data.'Locker Inventory' = true &&
     Self.Selected.Value in _Data.'Work Center'.Value
     }
     )
    )

     

    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

     

  • Jadarius Profile Picture
    41 on at

    @WarrenBelz,

     

    Sorry for the back and forth. The drop-down is a single selection. i tried that code you gave me and it return all the "Work Center" column Values, but for my email, I only have one work center value. see below:

    WChw.JPG

    I tried multiple codes in various ways. For example, I used the code below on the actual form and it made my drop-down disappear, not letting me edit anything. It was my best result without getting errors. I feel like I'm close, but I'm not sure how else to go about it.

    FORMVAR.JPG

    (I also added an "edit" button in the top right just to test) Do you have any other ideas for this?

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard