Skip to content

Power Apps

Power Apps People Picker Delegation Workaround

Power Apps People Picker Delegation Workaround Posted by - Matthew Devaney on - December 4, 2022 36 Comments When there are over 2,000 employees in an organi...

Matthew Devaney
Published
Reading time
6 min read

Before you start

Is this guide for you?

Best entry point
Power Apps
Time investment
6 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/power-apps-people-picker-delegation-workaround/. Author: Matthew Devaney.

Power Apps People Picker Delegation Workaround Posted by - Matthew Devaney on - December 4, 2022 36 Comments

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 Code language: CSS ( css )

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" Code language: JSON / JSON with Comments ( json )

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 } ) Code language: CSS ( css )

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" ] Code language: JSON / JSON with Comments ( json )

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" ] Code language: JSON / JSON with Comments ( json ) 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 : "" } Code language: JavaScript ( javascript ) 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' ) Code language: JavaScript ( javascript )

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' ); Code language: JavaScript ( javascript )

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) Code language: JavaScript ( javascript )

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 Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up 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. Matthew Devaney M365 Copilot Power Apps

How To Create Copilot Custom UI Widgets In Power Apps

Share this

Tagged

Power Apps

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →