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

Populate People Picker based on another choice field in PowerApps

Trying to pre-populate a people picker field based on another choice field.  I have set the defaulselecteditems but its not working.

 

 

Isaac

 

 

 

 
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Populate People Picker based on another choice field in PowerApps

Hi @ilanos ,

 

OK, What is the Items property of Dropdown 2?

 

Please try to set the DefaultSelectedItems property of Approver combobox as below:

 

If(
    Form1.Mode=FormMode.New,
    LookUp('SP list',ChoicesFieldName.Value=Dropdown2.Selected.Value).Approver, // If dropdown2 binds to a choices column
    Parent.Default
)

 

 Or

 

If(
    Form1.Mode=FormMode.New,
    LookUp('SP list',TextColumnName=Dropdown2.Selected.Value).Approver, // If dropdown2 binds to a Text column
    Parent.Default
)

 

 Sik

View solution in original post

11 REPLIES 11
Highlighted
Super User
Super User

Re: Populate People Picker based on another choice field in PowerApps

@ilanos
You need to provide a full set of details on your problem for the forum to help...

What code have you tried?
How does the other choices field look?
Can you provide a screenshot?

Any of these will help

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
Highlighted
Helper III
Helper III

Re: Populate People Picker based on another choice field in PowerApps

Here is the code:  When I enter a Title in the dropdown I want the Document Owner to display;

 

If(
    Form1.Mode=FormMode.New,
    {
      Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value, Mail)),
      DisplayName: Choices([@'WIP Documents'].'Document Owner').DisplayName,
      Email: LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value,Mail),
      Department:"",
      JobTitle:"",
      Picture: ""
    },
    Parent.Default
)
Highlighted
Community Support
Community Support

Re: Populate People Picker based on another choice field in PowerApps

Hi  @ilanos ,

 

There is something wrong with DisplayName part code, please try this:

If(
    Form1.Mode=FormMode.New,
    {
      Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value, Mail)),
      DisplayName: Dropdown2.SelectedText.Value,
      Email: LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value,Mail),
      Department:"",
      JobTitle:"",
      Picture: ""
    },
    Parent.Default
)

Sik

 

Highlighted
Helper III
Helper III

Re: Populate People Picker based on another choice field in PowerApps

Thanks,

 

The PeoplePicker is a multiselect field.  Will this work for multiple selections?

Highlighted
Community Support
Community Support

Re: Populate People Picker based on another choice field in PowerApps

Hi @ilanos ,

 

If it is the multi-select field, the DefaultSelectedItems should be a table instead of a record.

Please try this:

 

If(
    Form1.Mode=FormMode.New,
    Table({
      Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value, Mail)),
      DisplayName: Dropdown2.SelectedText.Value,
      Email: LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value,Mail),
      Department:"",
      JobTitle:"",
      Picture: ""
    }),
    Parent.Default
)

 

Hope this helps.

Sik 

Highlighted
Helper III
Helper III

Re: Populate People Picker based on another choice field in PowerApps

Getting close,

 

For the DisplayName I need to get the Current Approvers which is multi select:  This is what I have.

If(
    Form1.Mode=FormMode.New,
    Table({
      Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value, Mail)),
      DisplayName: Filter('WIP Documents',Dropdown2.SelectedText.Value).'Current Approvers',
      Email: LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value,Mail),
      Department:"",
      JobTitle:"",
      Picture: ""
    }),
    Parent.Default
)

 

Highlighted
Community Support
Community Support

Re: Populate People Picker based on another choice field in PowerApps

Hi @ilanos 

 

If you have resolved your issue, could you please mark your post as the answer? It would help other members find it quickly.

 

Sik

Highlighted
Helper III
Helper III

Re: Populate People Picker based on another choice field in PowerApps

For the DisplayName I need to get the Current Approvers which is multi select:  This is what I have.  Could yopu please assist?

If(
    Form1.Mode=FormMode.New,
    Table({
      Claims: "i:0#.f|membership|" & Lower(LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value, Mail)),
      DisplayName: Filter('WIP Documents',Dropdown2.SelectedText.Value).'Current Approvers',
      Email: LookUp(Office365Users.SearchUser(),DisplayName = Dropdown2.SelectedText.Value,Mail),
      Department:"",
      JobTitle:"",
      Picture: ""
    }),
    Parent.Default
)
Highlighted
Community Support
Community Support

Re: Populate People Picker based on another choice field in PowerApps

Hi @ilanos ,

 

I feel a little confused about the Filter code in DisplayName part.

Could you please answer my following questions?

What do you want to show in the combo box? The  Office365 person selected from DropDown2 Or the filtered Current Approvers?

What is the data source type of 'WIP Documents'? Which column do you want to filter base on?

What is the column type of Current Approvers?

Sik

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,355)