cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KrishnaC
Frequent Visitor

How to make a text field editable only for certain people.

Hi there,

I have a requirement where, I have 2 lists. List-A & list B

List-A has a column named 'Name' (single line of text)       [text field in PowerApps]

List-B has a column named 'Approvers' (Person or group).

 

I want to make the text field editable to only people added in the 'Approvers' column of List-B.  Any one else cannot edit it.

 

Any help would be highly appreciated.

Thanks & regards in advance 🙂

 

1 ACCEPTED SOLUTION

Accepted Solutions

@KrishnaC ,

It should be enabled if the values are correct. Again I have tested it - in the record where I have my name, the value of ChoiceTest is "C" and the field is enabled (in Edit Mode)

WarrenBelz_0-1623742911844.png

I change the code to "D" and it is disabled

WarrenBelz_1-1623742960299.png

 

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.

 

 

View solution in original post

12 REPLIES 12
WarrenBelz
Super User III
Super User III

Hi @KrishnaC ,

I am assuming you are testing the Approver in List-B against the current logged-in user. Something like this on the DisplayMode of the Text field should do the job.

If(
   !IsBlank(
      LookUp(
         AddColumns(
            'List-B",
            "ApproverName",
            Approver.DisplayName
         ),
         ApproverName = User().FullName
      ).ApproverName
   ),
   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.

@WarrenBelz 

Hey thankyou for the reply. But i've a doubt sir.

What exactly does "ApproverName" mean in your code? 

Is that a variable.?

Hi @KrishnaC ,

Firstly, please look the updated post - a bracket was in the wrong place (dangers of free-typing code)
To answer your question it is an added column name - you can call it DonaldDuck if you want.

I am using it for the lookup to compare two text values rather than complex field on one side.

 

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.

 

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.

@WarrenBelz 

I tried and it's throwing error. 

Screenshot (206).png

 

 

And thankyou for spending time in my post. 

Thanks & Regards,

Krishna

Hi @KrishnaC ,

Firstly the syntax is correct as below, so please look at your field and list values

WarrenBelz_0-1623711105647.png

Also is this a single-select or multi-select box and what does the error say?

 

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.

 

@WarrenBelz 

Actually that's a text field named Names which is in List-A 

My requirement is,

                   If someone from List-B Approver Column logins, that text field (List-A) should be editable, otherwise disabled.

The error says LookUp and AddColumn has some invalid arguments.

 

 

Thanks & Regards,

Krishna C

Hi @KrishnaC ,

That formula will work equally well on a Text control - I just used a button to demonstrate that it was valid - see below (I also tested it and it works as expected)

WarrenBelz_0-1623733101057.png

Can you please check the validity of your field and list names - also ensure you are running this from the DisplayMode of the Text 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.

 

@WarrenBelz 

Ok. Lemme check that once Sir.

 

Is it possible to give a condition over here?

like,

Suppose We've 2 columns in List-B. Approvers (Person) & Department (Choice Column) 

Department has 2 choices, say Sales & Marketing

make that text field editable to only people in List-B, who belongs to Marketing department. Is that possible?

 

Thanks & Regards,

Krishna

 

Hi @KrishnaC ,

Something like this

If(
   !IsBlank(
      LookUp(
         AddColumns(
            'List-B",
            "ApproverName",
            Approver.DisplayName,
            "Dept",
            Department.Value
         ),
         ApproverName = User().FullName && Dept = "Marketing
      ).ApproverName
   ),
   DisplayMode.Edit,
   DisplayMode.Disabled
)

Note that the .ApproverName at the end can be any field in the list - you are just checking that a record exists (hence the field is not blank)

 

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.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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