cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
carem
Helper III
Helper III

Can't pick People in Combo Box Person Field?

Hi everybody;

I have a List with 1 Person & Group Column:

Screen Shot 2019-12-06 at 11.42.51 AM.png

 

In PowerApp Studio, I create a Combo Box and Setting the Properties:

Items: Choices(TestPatchFunctionList.PersonField)

But when I click on the Combo Box, it can't display any of the User I have in Azure Directory.

Before clickBefore click

 

After clickedAfter clicked

 

 

I have another question, if I have Office365Users Connection in the App, I create a Combo Box to Populate User in some scenarios:

1/ All User  I have in Azure Directory

2/ User that is the Manager of Current User using the App

3/ Users that is the Direct Report of Current User using the App

4/ Users that are in a Specific Department

Can I do that?

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @carem 

 

It is not showing any values in this case, because the choice on a field of Person works when something is searched from the combobox. To rectify this, you need to Enable "Allow Searching" in the combobox properties.

Also, if you want to use the Office365Users connection, you can use below expressions:
Make sure that you have enabled "Allow Searching" in the control.

1/ All User I have in Azure Directory
Office365Users.SearchUser()

2/ User that is the Manager of Current User using the App
Office365Users.ManagerV2(User().Email)
This gets the Manager details for current loggedin user

3/ Users that is the Direct Report of Current User using the App
If(!IsBlank(User().Email),Office365Users.DirectReportsV2(User().Email))

4/ Users that are in a Specific Department
Filter(Office365Users.SearchUser(),Department = "Department1")

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
yashag2255
Dual Super User II
Dual Super User II

Hi @carem 

 

It is not showing any values in this case, because the choice on a field of Person works when something is searched from the combobox. To rectify this, you need to Enable "Allow Searching" in the combobox properties.

Also, if you want to use the Office365Users connection, you can use below expressions:
Make sure that you have enabled "Allow Searching" in the control.

1/ All User I have in Azure Directory
Office365Users.SearchUser()

2/ User that is the Manager of Current User using the App
Office365Users.ManagerV2(User().Email)
This gets the Manager details for current loggedin user

3/ Users that is the Direct Report of Current User using the App
If(!IsBlank(User().Email),Office365Users.DirectReportsV2(User().Email))

4/ Users that are in a Specific Department
Filter(Office365Users.SearchUser(),Department = "Department1")

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Thanks, @yashag2255 !

You save me a day. I will try the formula you give into suitable scenarios.

@yashag2255 

I want to patch the person who Direct Report and the manager of the Current User to the Person Field in Sharepoint.

I create 2 Buttons and set OnSelect Property:

Patch(TestPatchFunction, First(TestPatchFunction), {PersonField: Office365Users.DirectReportsV2(User().Email)})

Patch(TestPatchFunction, First(TestPatchFunction), {PersonField: Office365Users.ManagerV2(User().Email})

It reports an error: Invalid Argument Type, Expecting a Record but in a different Schema.

How Can I fix It?

yashag2255
Dual Super User II
Dual Super User II

Hi @carem 

 

The schema for a Person type field is different from what is returned through the Office365 connector.

You can use the below expression as:

Direct Reportees
Clear(ReporteeCollection);
ForAll(Office365Users.DirectReportsV2(User().Email).value,Collect(ReporteeCollection, {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & Lower,
Department:"",
DisplayName:displayName,
Email:mail,
JobTitle:".",
Picture:"."}));
Patch(TestPatchFunction, First(TestPatchFunction), {PersonField: ReporteeCollection})

Managers
Set(ManagerDetails,Office365Users.ManagerV2("user2@testmppco.onmicrosoft.com"));
Patch(TestPatchFunction, First(TestPatchFunction), {PersonField: Table({'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|" & Lower(ManagerDetails.mail),
Department:"",
DisplayName:ManagerDetails.displayName,
Email:ManagerDetails.mail,
JobTitle:".",
Picture:"."})
})

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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 (1,795)