cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

Populating email addresses from a drop down with user name selected

Hi PowerApp users,

i have 2 list.

Config list (EmailAddressList) have one item with a Persons field having multiple users.

another main list where Powerapps form is used.

I need to populate the Fullnames of users in a dropdown in the main list. So, i have used a collection on the visible property of the form-

Clear(PersonNames);Collect(PersonNames,ForAll(First(EmailAddressList).Persons,DisplayName))

And on the dropdown field (dropdown1), populated the display names using the above collection-

Items=PersonNames

Now, i want to get the equivalent email address of the person selected in the dropdown, i tried something like this-

 

ForAll(First(EmailAddressList).Persons,If(Dropdown1.Selected.Value=DisplayName,Email))

But this populates a dropdown even with blank values.

Attached a screenshot- 1st dropdown populates the user name (working as expected)

2nd dropdown (icould be happier if its just a text box) populating the email address of the user selected from 1st with black values as well.

How can i get just the email address.

Any help appreciated.

Regards,

Kevin

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Populating email addresses from a drop down with user name selected

Hi @kevingeorget,

 

What data source do you use?Is it SP list?

Is Persons one Person or Group type? If you want to use the Email base on the DisplayName , firstly,you should make sure the  users must be the ones in your group.

And use the formula expression you provide to create cascading dropdown, there is no issue to create cascading dropdowns on my side.

Could you please create one new to test again?If that is not Ok. You can try the following expression as:

Button.OnSelect: ClearCollect(Personstest,First('20190214EmailAddressList').Persons)   (you can use your collection name and list name to instead of “Persontest”,”20190214 EmailAddressList”)

Dropdown1.Items: Personstest.DisplayName  (displayname dropdown)

Dropdown2.Items: Sort(Distinct(Filter(Personstest, DisplayName=Dropdown6.Selected.Value), Email), Result) (email dropdown)

And do you want to the Email will be auto filled in one text box?

If you want to it is auto filled based on the first dropdown select display name, you need to create one new Email collection as the first one you do if you use forall formula expression.

 

I test as next:

Data Source:20190214EmailAddressList(my SP list name)

Persons(People or Group type, allow multiple selections)

EmailAdreesListDATASOURCE1.jpg

App Test:

Method1: use forall formula expression

Add one button and two dropdown controls and one label control.

Button.OnSelect: ClearCollect(PersonNames,ForAll(First('20190214EmailAddressList').Persons,DisplayName));ClearCollect(PersonEmail,ForAll(First('20190214EmailAddressList').Persons,Email))

Dropdown_DisplayName.Items: PersonNames.Value

Dropdown_Email.Items: ForAll(First('20190214EmailAddressList').Persons,If(Dropdown_DisplayName.Selected.Value=DisplayName,Email))

Label.Text: LookUp(PersonEmail,Value=Dropdown_Email.Selected.Value).Value

EmailAdreesListApptest1.jpg

Mehtod2:

Button5.Onselect: ClearCollect(Personstest,First('20190214EmailAddressList').Persons)

Dropdown6.Items: Personstest.DisplayName

Dropdown7.Items: Sort(Distinct(Filter(Personstest, DisplayName=Dropdown6.Selected.Value), Email), Result)

Label.2.Text: LookUp(Personstest,Email=Dropdown7.Selected.Value).Email

 

 

 

Result:

Mehtod1:

EmailAdreesListResultmethod1.1.jpg

EmailAdreesListResultmethod1.2.jpg

 

Method2:

EmailAdreesListResultmethod2.1.jpg

 

Hope this can be helpful.

Best Regards.

Yumia

View solution in original post

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Populating email addresses from a drop down with user name selected

Hi @kevingeorget,

 

What data source do you use?Is it SP list?

Is Persons one Person or Group type? If you want to use the Email base on the DisplayName , firstly,you should make sure the  users must be the ones in your group.

And use the formula expression you provide to create cascading dropdown, there is no issue to create cascading dropdowns on my side.

Could you please create one new to test again?If that is not Ok. You can try the following expression as:

Button.OnSelect: ClearCollect(Personstest,First('20190214EmailAddressList').Persons)   (you can use your collection name and list name to instead of “Persontest”,”20190214 EmailAddressList”)

Dropdown1.Items: Personstest.DisplayName  (displayname dropdown)

Dropdown2.Items: Sort(Distinct(Filter(Personstest, DisplayName=Dropdown6.Selected.Value), Email), Result) (email dropdown)

And do you want to the Email will be auto filled in one text box?

If you want to it is auto filled based on the first dropdown select display name, you need to create one new Email collection as the first one you do if you use forall formula expression.

 

I test as next:

Data Source:20190214EmailAddressList(my SP list name)

Persons(People or Group type, allow multiple selections)

EmailAdreesListDATASOURCE1.jpg

App Test:

Method1: use forall formula expression

Add one button and two dropdown controls and one label control.

Button.OnSelect: ClearCollect(PersonNames,ForAll(First('20190214EmailAddressList').Persons,DisplayName));ClearCollect(PersonEmail,ForAll(First('20190214EmailAddressList').Persons,Email))

Dropdown_DisplayName.Items: PersonNames.Value

Dropdown_Email.Items: ForAll(First('20190214EmailAddressList').Persons,If(Dropdown_DisplayName.Selected.Value=DisplayName,Email))

Label.Text: LookUp(PersonEmail,Value=Dropdown_Email.Selected.Value).Value

EmailAdreesListApptest1.jpg

Mehtod2:

Button5.Onselect: ClearCollect(Personstest,First('20190214EmailAddressList').Persons)

Dropdown6.Items: Personstest.DisplayName

Dropdown7.Items: Sort(Distinct(Filter(Personstest, DisplayName=Dropdown6.Selected.Value), Email), Result)

Label.2.Text: LookUp(Personstest,Email=Dropdown7.Selected.Value).Email

 

 

 

Result:

Mehtod1:

EmailAdreesListResultmethod1.1.jpg

EmailAdreesListResultmethod1.2.jpg

 

Method2:

EmailAdreesListResultmethod2.1.jpg

 

Hope this can be helpful.

Best Regards.

Yumia

View solution in original post

Helpful resources

Announcements
secondImage

New Return to Workplace

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

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,013)