We want our InfoPath Form to pre-populate the People Picker field with the person filling out the form (example below).
In my custom list I created two columns:
- Product Manager (Person or Group column)
For the Product Manager column I selected Account within the Show field drop down.
Click the List Tab, choose the Customize Form icon within the Ribbon.
Within the Ribbon, select the Data tab and then click the Form Load icon.
Click New > Action
Create a new condition. We want to look for when the people picker column is blank.
- Choose select a field or group from the first drop down
- Click the Show advanced view hyperlink (pictured below)
From the main data source, open the query fields folder and select the ProductManager (which is the person or group column in this example) field.
Choose the is blank rule condition.
Now create a rule to Set a field’s value.
Click the icon to locate the field you want to select.
Click the Show advanced view hyperlink
Within the ProductManager folder, select AccountId field
To set the AccountId value field to username() like the picture above, click the fx icon.
Select Insert Function, choose the User category and the userName function.
Publish your form. When you create a new list entry, the people picker field will default to the person filling out the form.
When you edit the list item, you will not override that value because of the condition we created, which only runs our rule when the field is blank.