0

I have a Power Apps Customized SP form, and I have a requirement to auto-populate a selected user's mobile and business phone numbers. Basically I have a Project Manager people picker field, then two text fields (Mobile Phone and Work Phone).

I have the Office 365 connector in my app, but none of the formulas I've tried seem to work. Keep getting errors. I tried this:

If(
    !IsBlank(DataCardValue2.SelectedItems), First(Office365Users.UserProfile(DataCardValue2.Selected.Email).BusinessPhones).Value
)

But it threw an error saying No user found with the specified ID. I've also tried just:

Office365Users.UserProfile(DataCardValue2.Selected.Email).BusinessPhones).Value

That doesn't work either.

My people picker is Datacardvalue2 (or Thisitem.ProjectManager) Then I have two text fields: Mobile Phone - Work Phone

Any help would be greatly appreciated.

Thank you.

1
  • Are you using single selection or multiple selection people field? Feb 2 at 18:41

1 Answer 1

1

If you are using single selection person or group field in SharePoint list, try using below solution which worked for me:

  1. Set Default property of Work Phone Data card control to:
If(
    IsBlankOrError(ThisItem.'Work Phone'),
    If(
        !IsBlank(DataCardValue2.SelectedItems),
        First(Office365Users.UserProfileV2(DataCardValue2.Selected.Email).businessPhones).Value
    ),
    ThisItem.'Work Phone'
)

enter image description here

  1. Similarly, set Default property of Mobile Phone Data card control to:
If(
    IsBlankOrError(ThisItem.'Work Phone'),
    If(
        !IsBlank(DataCardValue2.SelectedItems),
        Office365Users.UserProfileV2(DataCardValue2.Selected.Email).mobilePhone
    ),
    ThisItem.'Work Phone'
)

Output - in form:

enter image description here

Output - Data saved in list:

enter image description here


Office365Users.UserProfileV2() function retrieves the profile of a specified user. Learn more about available fields to select from the function output at: User resource type properties

1
  • You can also adjust the formulas based on form mode (new/view/edit) as per your requirements. Feb 3 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.