Monday, 13 November 2017

PowerApps - Default SharePoint People Picker Field To Be Logged In User

What
When you're building a PowerApp connected to a SharePoint List Form and you would like to capture the details of the person who is filling out the form.

Why
I understand that this is already captured via the 'Created By' SharePoint System field, but sometimes customers like to capture requestor name, phone, etc on the form itself rather than having to go to SharePoint to view it all.

Assumptions:
  • You've already created a PowerApp and added a 'Form' Control that uses a SharePoint List as a Data Source.
  • Your SharePoint List contains a People Picker Field
How
  • To pull back details about users, add another Data Source: View  Tab > Data Sources > Add Data Source > Office 365 Users
  • Click on the Card in the form that contains your People Picker Field
  • Go To Advanced and click 'Unlock to change properties' so that you can select the field itself
  • Click on the People Picker Field itself, then select the 'Default' function and type Office365Users.MyProfile()

Now when you open up the PowerApp it should automatically populate the People Picker field with the user who is logged in.

You can use the same concept to auto-populate other fields inside your form with specific user details.  For more info check out this Microsoft article explaining the Office 365 User Data Source: https://powerapps.microsoft.com/uk-ua/tutorials/connection-office365-users/

No comments:

Post a Comment