Populate People Picker Field On Selection Of A Dropdown Value

Introduction

 
In this article, you will learn how to populate a people picker SharePoint list column based on the selection of a dropdown value. 
 
Step 1
 
Create a SharePoint list with fields DropDownField & PersonField,
 
 
Step 2
 
Here let’s consider you are creating a standalone PowerApps application and do the following,
  • Add an Edit form (Form1) on Screen1.
  • Add the data source in our case SharePoint list created in Step 1.
  • Connect this list to Form1.
  • Make changes to the property of Form1 to DefaultMode=FormMode.New
  • Now Include a button set Text=’Submit’ and set OnSelect property to SubmitForm(Form1); ResetForm(Form1).
This is how your form looks after the above changes are applied.
 
 
Step 3
 
To populate the people picker field with users present in your Office 365 subscription it is necessary to add the Office 365 Users connector to your PowerApps apps. See the below picture,
 
 
Step 4
 
Now on PersonField DataCardValue, in my case DataCardValue3 as seen in the below picture add the below code to property DefaultSelectedItems,
 
  1. If(Form1.Mode = FormMode.New, {  
  2.     Claims: “i: 0 #.f | membership | ” & Lower(LookUp(Office365Users.SearchUser(), DisplayName = DataCardValue2.Selected.Value, Mail)),  
  3.     DisplayName: DataCardValue2.Selected.Value,  
  4.     Email: LookUp(Office365Users.SearchUser(), DisplayName = DataCardValue2.Selected.Value, Mail),  
  5.     Department: “”,  
  6.     JobTitle: “”,  
  7.     Picture: “”  
  8. }, Parent.Default)  
 
The DataCardValue2 is the DropDownField data card value in my case, see the below picture,
 
 
Step 5
 
On run, the output is as follows. On select of the dropdown value in DropDownField as Ashwini Bhandari, the people picker automatically fills the PersonField with user Ashwini Bhandari.
 
Sharing is Caring! 


Similar Articles