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

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
Dual Super User
Dual Super User

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
Dual Super User
Dual Super User

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!
taustin1
Level: Powered On

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.

Dual Super User
Dual Super User

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

taustin1
Level: Powered On

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,647)