InfoPath: Auto Populate People Picker to Person Filling Out the Form


Problem:

We want our InfoPath Form to pre-populate the People Picker field with the person filling out the form (example below).

People Picker Pre-Populated with User filling out the form

I was working with Tim Jones, co-worker of mine, on a project and he came up with this solution.  We wanted a way to accomplish this without any custom code or JavaScript, etc. We were utilizing InfoPath for customizing SharePoint 2010 list forms (which requires enterprise edition).  Here’s how we accomplished it:

Solution:

In my custom list I created two columns:

  • Title
  • Product Manager (Person or Group column)

For the Product Manager column I selected Account within the Show field drop down.

Person or Group column

Click the List Tab, choose the Customize Form icon within the Ribbon.

Customize Form

Within the Ribbon, select the Data tab and then click the Form Load icon.

Select Data > Form Load within the Ribbon

Click New > Action

Select 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)

Click Show advanced view hyperlink

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.

Select Product Manager column

Choose the is blank rule condition.

Product Manager is blank condition

Now create a rule to Set a field’s value.

Set a field's value

Click the icon to locate the field you want to select.

Select Field Icon

Click the Show advanced view hyperlink

Show advanced view link

Within the ProductManager folder, select AccountId field

Select AccountId field

Set AccountId to username()

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.

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.

People Picker Pre-Populated with User 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.

Advertisements

11 thoughts on “InfoPath: Auto Populate People Picker to Person Filling Out the Form

  1. Found this useful, but had a similar issue to welshes99. Another option that worked well for me is to use the Default Values option in infopath. Set the query field to username() and told it not to refresh the value when the formula is calculated.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s