cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Iro_
Helper I
Helper I

How to set as Default a specific record (User/Person) in a choices field?

Hi all,

 

I need to set as default a specific user (Person field in Sharepoint) in a choices field in my approvals power app.
Until now, the field searches for all company's Office 365 users, but I need to change it in order to set a specific person as approver.

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Iro_ 

So, the better choice is to have a Person Column in your list.  Then in your EditForm, you can simply add that field to it and everything will already be set for you.

The only thing you will need to do then is to set the DisplayMode of the control based on if there is a person assigned or not.

   If(IsBlank(Parent.Default), Edit, Disabled)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
RandyHayes
Super User
Super User

@Iro_ 

If you are using Office365 for your user records in your combobox (assuming combobox) then you will need to convert to a SharePoint user record.

However, I am not clear on what you mean by "set as default"?  Can you expand on that more and your scenario? 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hello @RandyHayes ,

 

Yes, I mean I want to lock the field (DisplayMode.Disabled), so that users will not be able to change the approver Person (meaning the user I will have already set as approver).

Example:

Iro__0-1617980271411.png


I could just write the approver's name, but I need the whole user's record (to use it later in a flow)

RandyHayes
Super User
Super User

@Iro_ 

So, if you already have a value in that column and you just don't want it to change, then set the DisplayMode property of the control to evaluate the fact that there is already a value.

A couple of questions:

1) Is this in an EditForm or freestanding?

2) What is the DefaultSelectedItems property of the control?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

It is in an edit form.

Well, that is actually my question. I tried to use DefaultSelectedItems like this: { Value: "Name Lastname" } 
which is obviously wrong. I don't know what I should put there since it is a record... Where do I get that info? Should I use the email of the approver or something else?

RandyHayes
Super User
Super User

@Iro_ 

So you have two questions then? - 1: how to set the DefaultSelectedItems and 2: how to make it disabled if it has a value

 

If so, then the next question is...why are you using Office 365 in the Items property of the combobox?  Is there a specific need for that source rather than the traditional SharePoint person column choices?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I use the Sharepoint person column choices because, until recently, users could select their approver. There was no 'default' approver, it could be any user. I guess that now I can create a new approver text field and delete the old one.

RandyHayes
Super User
Super User

@Iro_ 

So, the better choice is to have a Person Column in your list.  Then in your EditForm, you can simply add that field to it and everything will already be set for you.

The only thing you will need to do then is to set the DisplayMode of the control based on if there is a person assigned or not.

   If(IsBlank(Parent.Default), Edit, Disabled)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,019)