cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

How do I auto populate phone/location field of current user then change it if the another name is selected?

I have a SharePoint form with people picker field that auto populates the current user. Because it's a person field, the current user can change that value if they are filling out the form for someone else. I also have Phone, Email, Department, and City/Location field that I need to auto populate with the current user but change to the selected user's information. I have figured out each separately but I'm have issues trying to get both to work. Currently I have:

 

Default of Department field:

If(
SharePointForm1.Mode = FormMode.New && applicant=false,
Office365Users.UserProfile(User().Email).Department, Parent.Default) Or

 

If(
SharePointForm1.Mode = FormMode.New && applicant=true,

DataCardValue66.Selected.Department , Parent.Default)

 

OnChange in Name field:

Set(applicant, true)

 

I'm using Office365Users as my connector.

 

I also can't get the Phone/Location field to work:

DataCardValue66.Selected.Phone ⬅️ is not an option

and I don't know what to do with DataCardValue66.Selected.Claims

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: How do I auto populate phone/location field of current user then change it if the another name is selected?

Hi @taustin1 

 

Can you please check if you are setting applicant to false when the screen is loaded?
 
If not, then add the below expression on the OnVisible property of the screen: Set(applicant, false)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
Highlighted
Dual Super User III
Dual Super User III

Re: How do I auto populate phone/location field of current user then change it if the another name is selected?

Hi @taustin1 

 

I would recommend you to set all the controls based on the combobox for current user, this way you do not need to specify anything for the current user or selected user.
 
Configuration:
 
Department: 
If(SharePointForm1.Mode = FormMode.New, If(applicant=false, Office365Users.UserProfile(User().Email).Department, DataCardValue66.Selected.Department),Parent.Default)
 
There is a certain schema for the person's type field and it doesnot contain all the column, hence you have to use Office365 connector for phone and location as well.
 
Phone:
If(SharePointForm1.Mode = FormMode.New, If(applicant=false, Office365Users.UserProfile(User().Email).mobilePhone, Office365Users.UserProfile(DataCardValue66.Selected.Email).mobilePhone),Parent.Default)
 
Location:
If(SharePointForm1.Mode = FormMode.New, If(applicant=false, Office365Users.UserProfile(User().Email).OfficeLocation, Office365Users.UserProfile(DataCardValue66.Selected.Email).OfficeLocation),Parent.Default)
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Highlighted
Regular Visitor

Re: How do I auto populate phone/location field of current user then change it if the another name is selected?

Thanks @yashag2255,

 

This helped with the Phone and Location fields that I was stuck on but it's still not auto populating the current user's information when I open the app. It does change to the selected user successfully.

Highlighted
Dual Super User III
Dual Super User III

Re: How do I auto populate phone/location field of current user then change it if the another name is selected?

Hi @taustin1 

 

Can you please check if you are setting applicant to false when the screen is loaded?
 
If not, then add the below expression on the OnVisible property of the screen: Set(applicant, false)
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Regular Visitor

Re: How do I auto populate phone/location field of current user then change it if the another name is selected?

OMG!!! You have no idea how long I have been trying to get this to work! Thank you soooo much!!!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (9,545)