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

Re: How to Default a People Picker to current user & save to SharePoint List source

skylitedave
Level 10

Re: How to Default a People Picker to current user & save to SharePoint List source

This is quite tricky...  

  • You need to add the O365 Connector to the screen holding the form
  • You need to set the update property of the data card holding the Default User Information ( A dropdown in my case) to the JSON Object that SharePoint expects.... 
  • Using the command Office365Users.MyProfile() grab the currently logged in user from the Office 365 User Service Connector.  I am sure you can set it to someone else if you play around with it a bit... I have not done that yet.. 

 

here goes...

 

1 – Select the Screen holding the form

2 – Select  View Menu then the Tab Called  > Data Sources > Add Data Source >  then add Office 365 Users

3 – Select the PeoplePicker DataCard in PowerApps and Unlock it 

4 – Put the following in the Default for the DataCard to set default to Current User in a PowerApps form ( called 

              If( Account_Detail_Edit_Display_Long_1.Mode = FormMode.New,

                 Office365Users.MyProfile(),

                 ThisItem.OwnerA)

 

Where “Account_Detail_Edit_Display_Long_1” is the form name and “ThisItem.OwnerA” is the PeoplePicker field in the SharePoint list

 

5 - Now put the following in the Update Property for that DataCard within the Form

     If( Account_Detail_Edit_Display_Long_1.Mode = FormMode.New,
         {
             '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
              Claims:"i:0#.f|membership|" & Lower(User().Email),
              Department:"",
              DisplayName:User().Email,
              Email:User().Email,
              JobTitle:"",
               Picture:""
         }, SalesPerson_DD.Selected)

 

Works great for me

skylitedave
Level 10

Re: How to Default a People Picker to current user & save to SharePoint List source

Updated response above with info needed in the Default and Update properties

Anonymous
Not applicable

Re: How to Default a People Picker to current user & save to SharePoint List source

Set Default Property of control 

 

If(EditForm1.Mode = New,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:Concatenate("i:0#.f|membership|",User().Email),
DisplayName:User().FullName,
Email:User().Email
}, ThisItem.calumnName)

Or 
If(EditForm1.Mode = New, Office365Users.MyProfile(), ThisItem.calumnName)

crosbd
Level: Powered On

Re: How to Default a People Picker to current user & save to SharePoint List source

This worked for me and should be the recommended solution.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,681)