Forum Discussion

SetvarCurrentUserExis's avatar
SetvarCurrentUserExis
Copper Contributor
Jun 20, 2022

Sharepoint PowerApps Contact Details from Persons Column

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

  • Micca0815's avatar
    Micca0815
    Iron Contributor

    SetvarCurrentUserExis 

    One potential solution.

    This is the list in question:


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

     

    '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})})

     

    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


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

Resources