Sharepoint PowerApps Contact Details from Persons Column

Copper Contributor

Hi together,

 

I have a question regarding Sharepoint Power Apps:

I have a list consisting of the columns: Person, Email, Phone

What I want to achieve is that if I add a new item and type in the name of the person, the email and phone shall automatically be pulled from the person contact data.

 

I saw that this is possible to do with power apps but I only achieved to pull the data from the user that adds the new item (my own).

 

Do you know how I can solve my problem?

BR

 

1 Reply

@SetvarCurrentUserExis 

One potential solution.

This is the list in question:

Micca0815_0-1655828469930.png


Within the Power App built from your list, add an additional data source
(Office 365 Users, to get the business phone details)

Micca0815_1-1655828545380.png

 

'OnVisible' of the Edit Screen set a context variable, which is intended to keep track of the result for the user search against the Officer 365 connector. The 'DataCardValue5' is in my case the Person column form field.
Copy and paste the same formula into the onChange property of the 'DataCardValue5'.

UpdateContext({SelectedPersonLookup : Office365Users.SearchUser({searchTerm:DataCardValue5.Selected.Email})})

Micca0815_2-1655828732197.png

 

The default value of the DataCardValue4 (my e-mail field) would then be

First(SelectedPersonLookup).Mail

 and for the Phone number (which could included multiple numbers)

First(First(SelectedPersonLookup).BusinessPhones).Value


Additionally you could think about removing the option to manually alter the e-mail and phone number by changing the DisplayMode property of both form fields

Micca0815_3-1655829154395.png


Nevertheless you might need to adjust this solution furthermore, depending on your requirements.