Hi, I have managed to get the Current user to auto-populate in a SharePoint person lookup datacard. However the anciliary fields - department, Jobtitle, phone etc do not auto-populate onload.
App OnStart - Set(gvCurrentUser, Office365Users.MyProfileV2());
Name - DefaultSelectedItems (SharePoint Person Look-up)
If(EditForm1.Mode = FormMode.New,
{DisplayName: gvCurrentUser.displayName,Claims: "i:0#.f|membership|" & gvCurrentUser.userPrincipalName},
Parent.Default)
Anciliary Field e.g. Department - Default
First(Office365Users.SearchUser({searchTerm:DataCardValueofName.SearchText})).Department
In the example above the Department field is blank when the form is opened. When I delete the name in the Name person look-up field and re-enter, the Department field populates as expected... it just isn't automatically appearing on load.
You might ask, why I wouldn't just enter as the default value for the Department field -
Office365Users.MyProfile().JobTitle
The trouble is, often an administrator enters the form on behalf of somebody, so they need to overwrite the currentUser value. When this occurs, the anciliary fields should update to reflect this change. Therefore the MyProfile() option is not suitable.
Would anyone know how I get these anciliary fields populating based on the value in the Person lookup onload? All of these listed below:
Department: First(Office365Users.SearchUser({searchTerm:DataCardValueofName.SearchText})).Department
First Name: First(Office365Users.SearchUser({searchTerm:DataCardValueofName.SearchText})).GivenName
Job Title: Office365Users.UserProfile(DataCardValueofName.Selected.Email).jobTitle
Email: Office365Users.UserProfile(DataCardValueofName.Selected.Email).Mail
Mobile Phone: Office365Users.UserProfile(DataCardValueofName.Selected.Email).mobilePhone
Last Name: First(Office365Users.SearchUser({searchTerm:DataCardValueofName.SearchText})).Surname
Solved! Go to Solution.
Worked this out
Hi, I have managed to get the Current user to auto-populate in a SharePoint person lookup datacard. However the anciliary fields - department, Jobtitle, phone etc do not auto-populate onload.
App OnStart - Set(gvCurrentUser, Office365Users.MyProfileV2());
Name - DefaultSelectedItems (SharePoint Person Look-up)
If(EditForm1.Mode = FormMode.New,
{
DisplayName: gvCurrentUser.displayName,
Claims: "i:0#.f|membership|" & gvCurrentUser.userPrincipalName,
Department:"",
Email:User().Email,
JobTitle:"",
Picture:""
},
Parent.Default
)
Anciliary Field Default Value
Department
If(Len(EmployeeDataCardValue.Selected.Email)>0,Office365Users.UserProfile(EmployeeDataCardValue.Selected.Email).Department)
First Name:
If(Len(DataCardValueNAME.Selected.Email)>0,Office365Users.UserProfile(DataCardValueNAME.Selected.Email).GivenName)
Job Title: If(Len(DataCardValueNAME.Selected.Email)>0,Office365Users.UserProfile(DataCardValueNAME.Selected.Email).JobTitle)
Email: If(Len(DataCardValueNAME.Selected.Email)>0,Office365Users.UserProfile(DataCardValueNAME.Selected.Email).Mail)
Mobile Phone: If(Len(DataCardValue6.Selected.Email)>0,Office365Users.UserProfile(DataCardValue6.Selected.Email).mobilePhone)
Last Name:
If(Len(DataCardValueNAME.Selected.Email)>0,Office365Users.UserProfile(DataCardValueNAME.Selected.Email).Surname)
Business Phone:
If(Len(DataCardValueNAME.Selected.Email)>0,First(Office365Users.UserProfile(DataCardValueNAME.Selected.Email).BusinessPhones).Value)
Worked this out
Hi, I have managed to get the Current user to auto-populate in a SharePoint person lookup datacard. However the anciliary fields - department, Jobtitle, phone etc do not auto-populate onload.
App OnStart - Set(gvCurrentUser, Office365Users.MyProfileV2());
Name - DefaultSelectedItems (SharePoint Person Look-up)
If(EditForm1.Mode = FormMode.New,
{
DisplayName: gvCurrentUser.displayName,
Claims: "i:0#.f|membership|" & gvCurrentUser.userPrincipalName,
Department:"",
Email:User().Email,
JobTitle:"",
Picture:""
},
Parent.Default
)
Anciliary Field Default Value
Department
If(Len(EmployeeDataCardValue.Selected.Email)>0,Office365Users.UserProfile(EmployeeDataCardValue.Selected.Email).Department)
First Name:
If(Len(DataCardValueNAME.Selected.Email)>0,Office365Users.UserProfile(DataCardValueNAME.Selected.Email).GivenName)
Job Title: If(Len(DataCardValueNAME.Selected.Email)>0,Office365Users.UserProfile(DataCardValueNAME.Selected.Email).JobTitle)
Email: If(Len(DataCardValueNAME.Selected.Email)>0,Office365Users.UserProfile(DataCardValueNAME.Selected.Email).Mail)
Mobile Phone: If(Len(DataCardValue6.Selected.Email)>0,Office365Users.UserProfile(DataCardValue6.Selected.Email).mobilePhone)
Last Name:
If(Len(DataCardValueNAME.Selected.Email)>0,Office365Users.UserProfile(DataCardValueNAME.Selected.Email).Surname)
Business Phone:
If(Len(DataCardValueNAME.Selected.Email)>0,First(Office365Users.UserProfile(DataCardValueNAME.Selected.Email).BusinessPhones).Value)
User | Count |
---|---|
221 | |
99 | |
94 | |
55 | |
36 |
User | Count |
---|---|
273 | |
104 | |
104 | |
60 | |
60 |