Power Apps People Picker Delegation Workaround
When there are over 2,000 employees in an organization a people picker combo box will not include all employees by default. This problem is caused by Power Apps delegation limits. With the help of the Office 365 Users connector we can create a people picker to find any person in a company. Even if there are more than 2,000 people. In this article, I will show you how to build a people picker combo box.
Table Of Contents:
• Introduction: The I/T Hardware Request App
• Setup The SharePoint List
• Create A Form With A People Picker
• Delegation Problems With Using The Choices Function
• Populate The People Picker With Office 365 User Search Results
• Test The People Picker Combo Box
• Modify The People Picker Card's Update Property
• Submit The Hardware Request Form
• Test The People Picker And Form Submission
Introduction: The I/T Hardware Request App
The I/T Hardware Request App is used by managers to procure new computer equipment for their employees. The manager selects an employee from the combo box, selects the hardware and submits the form to the I/T department.
Setup The SharePoint List
Create a new SharePoint list called IT Hardware Requests with the following columns:
- Employee – person type
- Hardware – choices type (desktop computer, laptop, monitor, phone)
- RequestForRequest – multiple lines of text type
The SharePoint does not require any data initially. Once we start using our app to make hardware requests it will look like this:
Create A Form With A People Picker
Open Power Apps and create a new app from blank. Add a label to the top of the app with the text “I/T Harwdare Request Form.” Then add a data connection to the IT Hardware Requests SharePoint list.
Insert an Edit Form onto the screen and connect it to the IT Hardware Requests SharePoint list.
Change the DefaultMode of the form to New. This will create a new record when the form is submitted.
FormMode.New
The placeholder text in the combo box should say “find people” instead of “find items.”
Write this code in the InputTextPlaceholder property of the combo box to display the words “find people” when no selection has been made.
"Find people"
Delegation Problems With Using The Choices Function
Managers select the employee who needs new hardware by using the combo box. By default the Edit Form will use the Choices function in the Items property of the combobox. The Choices function is subject to delegation limits – it will only work on the first 500 people in an organization (configurable up to 2,000).
If the organization has more than 2,000 people only a partial list of employees will be available in the combo box. I will show you a workaround to ensure all members of an organization are selectable by using the Office 365 Users connector.
Populate The People Picker With Office 365 User Search Results
Add the Office 365 Users data connector to the app.
We will use the search for users (V2) feature of the Office 365 Users connector to populate the combo box with employee names.
Write this code in the the Items property of the combo box. The searchTerm parameter looks at what text the user has typed in to filter the results. Although the top parameter is only set to 50, the query still looks through all employees in the organization and retrieves the top 50 results. It is is not necessary to set it to the maximum value of 999 results to achieve the desired outcome here.
Office365Users.SearchUserV2(
{
searchTerm: cmb_Employee.SearchText,
top: 50,
isSearchTermRequired: false
}
)
We want to display the user’s full name and email in the combo search results.
Update the DisplayFields property of the combo box to this code.
["DisplayName","Mail"]
Similarly, we want to be able to conduct search against the user’s full name or email.
Use the same code in the SearchFields property of the combo box.
["DisplayName","Mail"]
Test The People Picker Combo Box
Let’s test the combo box to make sure it properly displays user names and emails from our organization. Select the dropdown button on the combo box . A list of employees will appear. If the desired employee does not appear in the list the user will have to use search to find them.
Search for an employee. The combo box will update as we type and should only display the matching results.
Modify The People Picker Card’s Update Property
When we changed the Items property of the form, the schema of the employee records we are working with also changed. We must modify the Update property of the employee card control to match this new schema. Otherwise, the employee record will not be written to the new SharePoint list item.
Use this code in the Update property of the employee card control. This is the same code you would use to Patch a person field.
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|"&cmb_Employee.Selected.Mail,
Department: "",
DisplayName: cmb_Employee.Selected.DisplayName,
Email: cmb_Employee.Selected.Mail,
JobTitle: "",
Picture: ""
}
Submit The Hardware Request Form
The people picker combo box setup is now finished. Next we will build a way for the manager to submit the form. Insert a new button at the bottom of the form.
Then use this code in the OnSelect property to submit the form.
SubmitForm('IT Hardware Request Form')
When the form is successfully submitted, we want to display a success notification and change the form to view mode.
Use this code in the OnSuccess property of the form.
Set(varCurrentRecord, 'IT Hardware Request Form'.LastSubmit);
Notify("Successfully submitted the form", NotificationType.Success);
ViewForm('IT Hardware Request Form');
We want the form to display the most recently submitted record while in view mode.
Change the Item property of the form to this code.
varCurrentRecord
If form submission fails, we should display a failure message instead.
Use this code in the OnFailure property of the form.
Notify("Error: form was not submitted", NotificationType.Error)
Test The People Picker And Form Submission
That’s all folks, go ahead and give the form a test-run. When the form is submitted it should create a new item in the SharePoint list.
Did You Enjoy This Article? 😺
Subscribe to get new Power Apps articles sent to your inbox each week for FREE
Questions?
If you have any questions about Power Apps People Picker Delegation Workaround please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.
Do you know if anything similar is possible with the “modern” combo box (the one you get by default on Powerapps for Teams)? There is lots I love about the modern one, but it seems to be missing the SearchText property, and I’ve not been able to find any way to capture what the user is entering to search.
This is good. Thank you for the special note… I thought it was necessary to have the top value as 999 😁
Deseye,
Yes, that is a common misconception that often involves collecting more data than needed 😀
Seems it’s not working from my end, after I update DisplayFields and Search Fields to [“DisplayName”,”Mail”], it will convert back to @odata.nextlink,how could I get rid of @odata,nextlink?
Wei,
Ugh. I dislike when this happens. See if you can define it after typing some value into the search field.
Seems it’s blank after I tried to type something in Combo box,but If I switch to office365users.SearchUser instead of V2, the odata.link is gone,I’ve no ideal why it will happen like this.
It seems the search field is blank after I tried to type something, but If I change the item to office365Users.searchUser instead of V2, the odata,nextlink is gone, I’ve no ideal why the odata.nextlink would be displayed in V2 only.
Hi, found a solution! Check here https://powerusers.microsoft.com/t5/Building-Power-Apps/Office-365-Search-User-v2/td-p/645525
So add a .Value to the end and it will work fine
Perfec Fahim!
Can you please stop sending these emails on a Sunday? This can wait until Monday.
Paul,
Hilarious. Best comment I’ve received all year. I assume you are making a joke 🙂
I like to send it on Sunday so my readers in India can view it on Monday morning in their country
Rudest thing I have seen in awhile. This man does this for our benefit. Unsubscribe then.
Jordan,
I know, right?
It’s strange but my organisation has over 50,000 users on the Tenant and I don’t seem to run into any problems using the default people picker (using choices). I can select any of the many users. I am using the same method of connecting to a People field in SharePoint. I wonder why that is?
Same here, we have over 8000 and the default people picker (using choices) works just fine. No delegation error.
Yes, the default choices option works for me as well with well over the limits Matthew describes here. BTW – Thanks for the great posts and your hard work providing them!
Hey thanks for the post Matt. Good stuff!
I have a requirement where all of the individuals might not be known when the form is initially be submitted. On the Update property for the data card I added:
If(IsBlank(cmb_WFP_Main.Selected.Mail), Blank(),
{
‘@odata.type’: “#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser”,
Claims: “i:0#.f|membership|”&cmb_WFP_Main.Selected.Mail,
Department: “”,
DisplayName: cmb_WFP_Main.Selected.DisplayName,
Email: cmb_WFP_Main.Selected.Mail,
JobTitle: “”,
Picture: “”
})
Is this how you would handle something like this or might there be a better way? Thanks in advance.
Jordan,
Your IF statement code is generally good. But I have one small suggestion to improve. Change the ISBLANK to !ISBLANK. Then you only need 2 parameters instead of 2 parameters
If(!IsBlank(cmb_WFP_Main.Selected.Mail),
{
‘@odata.type’: “#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser”,
Claims: “i:0#.f|membership|”&cmb_WFP_Main.Selected.Mail,
Department: “”,
DisplayName: cmb_WFP_Main.Selected.DisplayName,
Email: cmb_WFP_Main.Selected.Mail,
JobTitle: “”,
Picture: “”
})
Hey Matt, thanks for your reply earlier in the year, realized I never got back to you.
I am struggling with the comboboxes resetting to blank after I go and make an update. So if I change one value in a combobox all the other combobox values get auto-set to blank except for the one I changed. Just found this bug during a test today.
I have form’s item connected to a gallery so I can look at the various submissions on the left and the details on the right. Any help would be so appreciated! Thank you.
Jordan
When I am using v2 connector @odata.NextLink is coming in the fields section instead of display name and email.
When using the v2 connector you need to end the items code with .value the you can set the display and search fields properly and get rid of the @odata.NextLink
Office365Users.SearchUserV2(
{
searchTerm: cmb_Employee.SearchText,
top: 50,
isSearchTermRequired: false
}
).value
I don’t know why he doesn’t correct the article with this information. Also, when allowing multiple selection it’s a whole other story. His other article about multi-select for people picker is limited and doesn’t not work either. It also lacks explanation for the code.
Very good point for existing and new Makers. I highly recommend to use also a defined filter on the connector, so for example filter accounts that are disabled in the directory (no one wants to send request to a user account that is disabled 😉 and all of our customers have so called service accounts that follow a naming standard, think about filtering then also, and so on.. thank you for your effort on the Power Platform Community!
I doing something like that but without the SharePoint list. I could not make the Choices for Office365 work. Any advice?
Great explanation. I am trying to acheve something similar but with an off-line application. My problem is not the quantity of users but the way to put them in a peoples picker after loading them in a collection.
Hello. Congratulations on the content. I did most of it, but I’m not able to display the Name and Email combo, as well as search for the same fields. Any tips?
Is there a way to submit to SharePoint with multiple Employees selected? I have a need for the user to be able to select multiple employees in the Combo Box and right now when multiple are selected it only submits the last one.
I am struggling with multiple people also…
Employees: ForAll (
ComboBoxEmployees.SelectedItems,
{
‘@odata.type’: “#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser”,
Claims: “i:0#.f|membership|” & Mail,
Department: ThisRecord.Department,
DisplayName: ThisRecord.DisplayName,
Email: “”,
JobTitle: “”,
Picture: “”
}
),
Why are you skipping Mail and why doesn’t it have ThisRecord before it? I found when doing this the Mail value is always blank.
Hello,
I downloaded a timesheet template. It goes to a SP List with user and user manager information. The assigned manager within the system is not the actual time keeper, who I actually want the requests to route to. How do I alter the code to send it to a specific individual and not the assigned manager? Picture attached.
Preview forms and Preview Combo box do not work. Had to use Classic form. Did have to make one additional Update, DefualtSelectedItems -> Office365Users.SearchUserV2({searchTerm:ThisItem.Name.DisplayName, top:1}).value
O MY , O MY Your life saver. I surfed the entire internet and couldn’t find a multi select people picker filer for my “assigned to ‘ column in SP. (We wanted to filter tasks by assignee SP person column allows multi select) . Sooo glad I found your solution Just take a blessing of a busy mom hassling the whole day looking for a solution, here you come with 8 min video saved mine and my baby’s night/weekend. God bless you again again .Thank you so much for taking your precious time . It’s unbelievable there is no solution on internet for this scenario…incorporated your combobox items property with https://www.youtube.com/watch?v=tU7nFD03Dd8 for filter the gallery. I consume your solutions so frequently. keep it up.