I have a Sharepoint list field that is set to 'People or Group' and I'd like to auto-populate the comboBox in my Power App with the DisplayName of the current user.
I have a variable _myProfile that creates a record for each user but it cannot set the defaultselectedItems value for my Combobox, is there another way to accomplish this?
Solved! Go to Solution.
If this is a ComboBox, then you will want to set the DefaultSelectedItems property not the Default.
In your DefaultSelectedItems, place the following formula (assuming that your _myProfile has an email address as well):
With({profile:Office365Users.MyProfile()},
{Claims: "i:0#.f|membership|" & profile.Mail,
Department: profile.Department,
DisplayName: profile.DisplayName,
Email: profile.Mail,
JobTitle: profile.JobTitle,
Picture: "."
}
)
Make sure you have AllowSearching on.
I hope this is helpful for you.
If this is a ComboBox, then you will want to set the DefaultSelectedItems property not the Default.
In your DefaultSelectedItems, place the following formula (assuming that your _myProfile has an email address as well):
With({profile:Office365Users.MyProfile()},
{Claims: "i:0#.f|membership|" & profile.Mail,
Department: profile.Department,
DisplayName: profile.DisplayName,
Email: profile.Mail,
JobTitle: profile.JobTitle,
Picture: "."
}
)
Make sure you have AllowSearching on.
I hope this is helpful for you.
I would recommend you follow the advice of @RandyHayes. But I would also like to point out that you have placed your code inside the Default property and not the DefaultSelectedItems property as mentioned within your title.
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."