cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yvsuhas
Level: Powered On

Get Email Address from People Picker field and update Email field when people picker changes

I'm failry new to PowerApps and have ample experince with Infopath forms. I have a people picker field which is called "Employee" and I want to get the default user profile properties of the user selected in that Employee field. I'm able to set the people picker field to the current logged in user using the following code in the DefaultSelectedItems property of the DatacardValue22.

 

{
Claims: "i:0#.f|membership|" & Lower(Office365Users.MyProfile().Mail),
DisplayName: Office365Users.MyProfile().DisplayName,
Department: Office365Users.MyProfile().Department,
Email: Office365Users.MyProfile().Mail,
JobTitle: Office365Users.MyProfile().JobTitle,
Picture: ""
}

 

Because the primary text of the peoplepciker field is DisplayName, it is working fine and showing my name but I want to get the Email and other properties from the user profile and show them in respective text fields which will be disabled on the form. I'm not able to acheive that and also the properties need to update when I change the value of the 'Employee' Poeple Pciker field. Please help me on how to acheive this.

 

NOTE: There should be definitely a cleaner way to approach the set current user properties part but being new, I'm not entirely sure of that, I tried few ways using global variables and failed. I created the PowerApp from the studio and used a modern list as a datasource and I don't have the SharePoint Integrator yet as still PowerApps is not generally available to our environment as we have 'Classic Mode' at the tenant level.

1 ACCEPTED SOLUTION

Accepted Solutions
yvsuhas
Level: Powered On

Re: Get Email Address from People Picker field and update Email field when people picker changes

I found the answer and it is the following text in the Default property.

 

Office365Users.UserProfileV2(DataCardValue22.Selected.Email).mail

View solution in original post

5 REPLIES 5
K-A-R-L
Level 10

Re: Get Email Address from People Picker field and update Email field when people picker changes

Hi @yvsuhas,

 

I'll assume you are using form instead of gallery. Can you please unlock the DataCard, go to Advanced and set DisplayFields of your Card: People Picker to this:

["Email","DisplayName","Picture"]

If you are using gallery please let me know.

Cheers

 

 

Community Support Team
Community Support Team

Re: Get Email Address from People Picker field and update Email field when people picker changes

Hi @yvsuhas ,

 

Set the DisplayFields from ["DisplayName","Email","Picture"] to:

["Email","Picture"]

Capture.JPG

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
yvsuhas
Level: Powered On

Re: Get Email Address from People Picker field and update Email field when people picker changes

Hi @K-A-R-L ,

 

Thank you for responding. I'm using a form and my display fields are set to the values "["DisplayName","Email","Picture"]" for the Employee data card value but I'm not able to extract the Email address from the field as something like Employee.Email or DataCardValue22.SelectedItems.Email. I also need other properties like Department, Job Title and Phone Number as well.

 

Regards,

Suhas

yvsuhas
Level: Powered On

Re: Get Email Address from People Picker field and update Email field when people picker changes

Hi @v-monli-msft ,

 

Is there a reason to remove "DisplayName" from the display fields of the person data card?

 

Thanks,

Suhas

yvsuhas
Level: Powered On

Re: Get Email Address from People Picker field and update Email field when people picker changes

I found the answer and it is the following text in the Default property.

 

Office365Users.UserProfileV2(DataCardValue22.Selected.Email).mail

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,642)