cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jhowell
Advocate I
Advocate I

Populate People Picker with Current User

Hello All,

 

I have a form in powerApps that is linked to a Sharepoint list.

 

I've been trying to populate a people picker in this form with current user info.

 

I thought I figured it out using Office365Users.MyProfile() in the default field of the card.

 

However, when I submit the form to my sharepoint list the user information does not go through.

 

Any help with this would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

I just had a breakthrough with this issue.

 

I found this Microsoft blog post in the description of a random youtube video

 

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/ 

 

In the screens OnVisible property I put

Set(myself, User())

 In the Combo Boxes DefaultSelectedItem property I put

If(
    EditForm1.Mode = FormMode.New,
    {
        DisplayName: myself.FullName,
        Claims: "i:0#.f|membership|" & myself.Email
    },
    Parent.Default)

Be sure to change the form name in red to correspond to your form. 

 

Now my PowerApp will autofill the Person Box with the current user, and submit to my sharepoint list.

 

Thanks again for the help iAm_ManCat

View solution in original post

7 REPLIES 7
iAm_ManCat
Super User II
Super User II

Hi,

 

Have you checked the Update value for the datacard, you may need it to point to the OData value of your Office365 User Lookup as People pickers require OData values (which are normally present when they use the standard lookup vs pre-filling it):

 

{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#f|membership|" & DataCardValue6.Selected.Email,
Department:"",
DisplayName:DataCardValue6.Selected.Email,
JobTitle:"",
Pictures:"",
Email:DataCardValue6.Selected.Email

}

 

Could you try something like that and let me know how you get on?

 

Thanks,

ManCat

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


You'll have to forgive me, I've very new to PowerApps.

 

I took all of the code you provided and put it into the update field of the Requester datacard. 

 

I also changed it accordingly.

 

{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#f|membership|" & DataCardValue8.Selected.Email,
Department:"",
DisplayName:DataCardValue8.Selected.Email,
JobTitle:"",
Pictures:"",
Email:DataCardValue8.Selected.Email

}

 

I'm getting a "Not a valid connector error response"

 

Screenshot.png

 

Thanks for the help so far.

 

Let me know if there's any other info I could provide

 

 

Heya!

 

That's ok, we're all at different stages of learning 🙂

 

Your 'Assigned To' card is the one you are defaulting, correct? if you click the DataCard (larger container) for that either in the editor or on your left-hand list of objects, then on your right side you should see some properties - click advanced and then check what it is using for Update - this is the value it will use when the form is submitted to update/fill that field:

 

image.png

This is then where the formula I gave you should go (click the Update label itself to go to the formula bar):

 

@Shanescows did a good video on patching SharePoint Online using complex columns (and has LOADS of other videos on his channel for anyone learning Power Apps):

https://www.youtube.com/watch?v=gsk14D-CYRE

 

If you could give that a try and then let me know if we're any closer to a result - Did you add any code to the bottom button that is showing the error? If yes, we may need to remove that.

 

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Still no luck getting this to work. 

 

I'll update the thread if I find a solution

I just had a breakthrough with this issue.

 

I found this Microsoft blog post in the description of a random youtube video

 

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/ 

 

In the screens OnVisible property I put

Set(myself, User())

 In the Combo Boxes DefaultSelectedItem property I put

If(
    EditForm1.Mode = FormMode.New,
    {
        DisplayName: myself.FullName,
        Claims: "i:0#.f|membership|" & myself.Email
    },
    Parent.Default)

Be sure to change the form name in red to correspond to your form. 

 

Now my PowerApp will autofill the Person Box with the current user, and submit to my sharepoint list.

 

Thanks again for the help iAm_ManCat

View solution in original post

This works correctly

I looked all afternoon for a solution, Thanks.

Only change here was SharePointForm1.Mode = FormMode.New,

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,539)