People picker Control in PowerApps

With the latest PowerApps update we can do more customization to achieve more use-cases. Especially with the new "Rule" feature in PowerApps(which keeps remembers me of InfoPath form 😏)

But, Then I was looking for People picker control in this latest PowerApps update. cant find any straight forward control thought. But now saw a connector called "Office365Users" then I started exploring it.


How to create People picker control in PowerApps

Update

1. Add "Office365Users" data source to the app.
2. Insert a "Combobox" from the ribbon.
3. Select "Combobox" and select 'Items' in the formula bar then enter below formula
Office365Users.SearchUser({searchTermComboBox1.Text})
4. Then, select "Fields" from the property pane and choose "Primary text" a.k.a "Display Names" and "Search Fields".
5. Play the app and test it.


The below steps applies mostly in the early stages/release of PowerApps now that its matured enough, so follow the updated steps instead.

There are a couple of controls and ways to create People Picker control
  1. Using Input box & ListBox
    • On-demand/Autocomplete users (With rules)
    • Prepopulated users (Without rules)
  2. Using ComboBox control
    • on-demand/Autocomplete users
    • Prepopulated users

App Setup

First, Add "Office365Users" data source to the app
Second, design the app with Input box, ListBox, ComboBox controls



Using Input box & ListBox control

Prepopulated [without rule]:

This is NOT RECOMMENDED as this will prepopulate users, when user base is huge it will certainly degrade the app performance.

Select list box -> formula bar


Office365Users.SearchUser({searchTerm:txtSearchUser.Text}).UserPrincipalName



On demand [With rules]:

This will query user as we type in textbox, follow the below step and add this formula


If(Rule3, Office365Users.SearchUser({searchTerm:txtSearchUser.Text}).UserPrincipalName)



Using ComboBox control

Prepopulated [without rule]:

This is NOT RECOMMENDED as this will prepopulate users, when user base is huge it will certainly degrade the app performance.


Office365Users.SearchUser({searchTerm:ddlDetailedPeoplePicker.SearchText})



On demand [With rules]:

This will query user as we type in combobox, follow the below step and add this formula


If(Rule2, Office365Users.SearchUser({searchTerm:ddlPeoplePicker.SearchText}))



Now, Select "Display fields":

Then finally select "Search Fields":
 



Run the app



Comments

  1. Hi, this is great but i wish the instructions were clearer? There is a lot of guess work and i can't get passed the first couple of steps because i don't know how to the define the controls.

    ReplyDelete
    Replies
    1. Hello, Please refer related articles to establish new data source:
      http://ratsubsharewall.blogspot.com/2017/03/develop-powerapps-from-scratch-series1.html

      Then, Go to Insert->Control->Listbox/Combobox

      Delete
    2. I cannot get a combo box to display anything in a dropdown. I really like what you have here where you search the combo box, then display the DisplayName and Mail (actually exactly what I need), but when i search there are no options that show up.

      However, when i connect the combo box search to a list box all the options show in the list box.

      Any idea why the results do no show in the combo box?

      Delete
    3. Make sure you did mapped "Search Field" and "Display Fields" for Combobox.

      Delete
  2. What are the rules that you created? You say that the rules are needed but you don't actually show the full rule you created. That makes me sad, now I need to go find a different explanation how to create the people picker.

    ReplyDelete
    Replies
    1. If(Rule2, Office365Users.SearchUser({searchTerm:ddlPeoplePicker.SearchText})) check this image to configure rules.

      Delete
  3. Very interesting. Could you wire up the listbox to display users from a multi-value person column from a SharePoint list?

    ReplyDelete
  4. This is a very nice article. thank you for publishing this. i can understand this easily..!!..Azure Online Course

    ReplyDelete
  5. This is amazing!! Thank you so much, exactly what I needed. 'On Demand [with rules] for the combo box is the way to go.

    ReplyDelete
  6. For the people that didn't manage to follow this in the first couple of tries. I was stuck at the rules thing (combobox case).
    I tried to click on 'Define actions' and put in the formula that way, but that is not necessary. These are the steps that I followed:
    1) Add the rule
    2) Define the condition
    3) Exit the rule screen
    4) Add the formula given by Rathanavel to the Items property of the combobox (replacing the name of your just created rule)

    If you go back to your rules you will notice that PowerApps itself put the actions there.

    Thanks Rathanavel for this solution.

    ReplyDelete

Post a Comment

Enter your comments..

Popular posts from this blog

Upload attachment to SharePoint list item using Microsoft Flow

Developing custom reusable components in PowerApps

HTML field & Date Time formatting in powerapps

Step-By-Step Azure AD App Registration

Develop Powerapps from the Scratch - Series1/3

Create and configure custom connectors for PowerApps and MSFlow from AzureFunctions

Create multilingual app in PowerApps