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

PowerApps. error while trying to Auto-populate using Office 365 users connection

Hi Guys,

I am still working on my PowerApps and trying to configure few fields to Autopopulate.

Before I tried using Azure AD data connection to do this (https://powerusers.microsoft.com/t5/Building-Flows/Auto-populating-fields-from-AD-on-PowerApps/m-p/7...) that didn't work, so now I am trying to use the "Office 365 users connection" (https://powerapps.microsoft.com/ro-ro/tutorials/connection-office365-users/)

On my sharepoint list, I have couple of fields, once the user selects a person in the people picker field, then the other fields (e.g. email, mobile, location, job title) should auto-populate.

For example:
I am using the function: "Office365Users.UserProfile(RequestedOnBehalfOf_DataCard1.DataField).Mail" from the email field and trying to reference the peoplepicker field ("RequestedOnBehalfOf_DataCard1") to get the profile of the person that is selected and then autopopulate the email.

Please see the screenshots attached. I have highlighted the two fields that are in play.

Any help is greatly appreciated.

Office365 connections error.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: PowerApps. error while trying to Auto-populate using Office 365 users connection

Hi @IntergenUser01,

 

Yes, here the OnChange property of the People Picker control should be used to get the User Profile data.

For example, under the OnChange property of the People Picker control, specify the following code:

ClearCollect(PeopleData,Office365Users.UserProfile(DataCardValue14.Selected.Email))

Then under the Email Field, specify the code below:

First(PeopleData).Mail

You should be able to get the other fields with the following format:

First(PeopleData).FieldName

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
6 REPLIES 6
IntergenUser01
Level: Powered On

Re: PowerApps. error while trying to Auto-populate using Office 365 users connection

Hi,

 

I have managed to get the item to display the correct value, but the automation is still a problem (someone selecting a person and the other fields (e.g. email, mobile, location, job title) auto-populating.

 

I believe I would need to use onchange functionality to achieve this but not sure how to go about doing this.

Community Support Team
Community Support Team

Re: PowerApps. error while trying to Auto-populate using Office 365 users connection

Hi @IntergenUser01,

 

Yes, here the OnChange property of the People Picker control should be used to get the User Profile data.

For example, under the OnChange property of the People Picker control, specify the following code:

ClearCollect(PeopleData,Office365Users.UserProfile(DataCardValue14.Selected.Email))

Then under the Email Field, specify the code below:

First(PeopleData).Mail

You should be able to get the other fields with the following format:

First(PeopleData).FieldName

Regards,

Michael

 

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

Re: PowerApps. error while trying to Auto-populate using Office 365 users connection

Hi Michael,

 

What is the "PeopleData" on the line:

 

ClearCollect(PeopleData,Office365Users.UserProfile(DataCardValue14.Selected.Email))

 

It is giving an error.

 

Also, why are you using "DataCardValue14" there? (which is also giving an error

Office365 connections error2.PNG

 

Community Support Team
Community Support Team

Re: PowerApps. error while trying to Auto-populate using Office 365 users connection

Hi @IntergenUser01,

Sorry about that.

DataCardValue14 is the control name which I used to get the User from SharePoint list.

 

You should replace it with your control.

In your example, it should be written in the following way:

ClearCollect(PeopleData, Office365Users.UserProfile(RequestedOnBehalfOf_DataCard1.DataField))

PeopleData is a collection used to store the Profile data.

 

Regards,

Michael

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

Re: PowerApps. error while trying to Auto-populate using Office 365 users connection

Hi @v-micsh-msft

 

So I have used:

 

ClearCollect(PeopleData, Office365Users.UserProfile(RequestedOnBehalfOf.Email))

 

as 

ClearCollect(PeopleData, Office365Users.UserProfile(RequestedOnBehalfOf_DataCard1.DataField))

was giving an error.

 

For the following lines of code that you gave, e.g.:

First(PeopleData).Mail

 

Does that go in the Emails text input default property?

 

Thanks

 

IntergenUser01
Level: Powered On

Re: PowerApps. error while trying to Auto-populate using Office 365 users connection

Hi @v-micsh-msft

 

So I have used:

 

ClearCollect(PeopleData, Office365Users.UserProfile(RequestedOnBehalfOf.Email))

 

as 

ClearCollect(PeopleData, Office365Users.UserProfile(RequestedOnBehalfOf_DataCard1.DataField))

was giving an error.

 

For the following lines of code that you gave, e.g.:

First(PeopleData).Mail

 

Does that go in the Emails text input default property?

 

Thanks

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Top Kudoed Authors
Users Online
Currently online: 290 members 4,289 guests
Recent signins:
Please welcome our newest community members: