cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dvictor881
Helper I
Helper I

PowerApps People picker - Current User

I have a people picker field in the SharePoint list and I am displaying that in PowerApps in New Form. Users should be able to enter user name and submit the form. It is working as expected.

 

Also, I would like this people picker to show current user name by default when new form shows up and if user doesn't change this in the people picker, it should just save current user name in the people field in SharePoint. I know that I can display current user by User().DisplayName but I am not sure where to put that. I have tried adding it in the Default property but that is not working. It is giving an error property expects record value but this produces a text value. 

39 REPLIES 39
Anonymous
Not applicable

Simpler (newer?) solution to adding default users: 

 

people.png

This doesn't seem to properly work for me.  It will update the field in powerapps with the users name, but when submitting, it doesn't actually pass the user to the person field in the sharepoint list.  Did it work for you?

Setting the Default and DefaultSelectedItems does not work for me and it does not get saved. I've tried changing the Update property of the data card as well but no luck. Has anything changed?

Brice235i
Impactful Individual
Impactful Individual

not with this new simple method.  Please refer to my older post, but here it is again.

 

on the App Onstart action set the following variables:

Set(gvCurrentUser, Office365Users.MyProfileV2());

Set(gvCurrentManager, Office365Users.ManagerV2(gvCurrentUser.userPrincipalName));

 

for the person field on the DefaultSelectedItems action

 

If(IsBlank(ThisItem.’Applicant’),

{

DisplayName: gvCurrentUser.displayName,

Claims: "i:0#.f|membership|" & gvCurrentUser.userPrincipalName,

Department:gvCurrentUser.department, 

Email:User().Email, 

JobTitle:gvCurrentUser.jobTitle

},

Parent.Default

)

where is the OnStart option?  This doesn't seen to exist anywhere in my form.

 

I have looked everywhere in the datacards, fields, etc and No OnStart

@hyperbob0811 ,

 

Very top of the tree...

 

Pick "App..."  then the OnStart control is there.

 

martinav_0-1603224724531.png

 

 

 

@martinav 

 

Thanks I found it after I had posted the question.

This helped me, Thanks Jeff.

 

Saan.

Thanks works for me either . If I want to have the Display name and not the email where i need to change it 

Thanks 

Almog

AsaurdiffADTill
Helper I
Helper I

THERE IS A BETTER WAY NOW!!

This resolves the issue of patching/submitting the app user (User() ) to a sharepoint Person/Group Column. 

The Person/Group Column, whether in a form or freestyle, utilizes the ComboBox with the items set to Choices([@ambiguousSPOList].ColumnName), this makes sure the data is patched/submitted correctly when done. 

Below is the code you can place into the "DefaultSelectedItems" of the ComboBox: 

Lookup('SPOListDataTable'.ColumnName As CN, CN.ColumnName.Email = User().Email).ColumnName

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (3,293)