Promoting InfoPath columns to SharePoint is typically a very straightforward task. You go through InfoPath’s publishing wizard, select the InfoPath fields you’d like to promote, and you’re ready to go.
But what if you need to publish a value to a Person field that is defined in SharePoint? Maybe you need to build a workflow that uses the person’s information, or just want to see the person’s presence in the form library. Or, in the case of what I experienced, you needed to create views that filtered this InfoPath field by the person that was currently logged in. Try using the [Me] filter on a non-Person field in SharePoint…it doesn’t work.
A Person field is a field who’s type is that of “Person or Group”, and it allows you to select SharePoint users from the people picker. For this example, I’m going to create a Supervisor column in my SharePoint list, so that I can promote my InfoPath field to it:
In theory, you should be able to just go through InfoPath’s publishing wizard and select your column to promote. If you don’t already have a column defined, it will create one for you in the list, and if you just go through the publishing wizard, it’ll create a “Single line of text” column for you. Since we already have a column defined, specifically the Supervisor column which is of type Person, we need to select this from the wizard. A lesser known feature in InfoPath is the ability to map an InfoPath field to an existing column in the list, or even a site column defined on the site or site collection:
From the “Site column group” drop-down list, select "(This document library)”, which will then allow you to select a column that has already been defined in the list. Choose Supervisor and click OK. Oops! You get a nasty error message:
As it turns out, you cannot promote a text field to a Person field in SharePoint. I even tried to finagle the Contact Selector, and trying to promote its data, and I get the same result. Here’s a little workaround to this issue:
Step 1: Create the Person field in SharePoint.
Step 2: Promote the InfoPath field to an additional column
For this example, I’m promoting my supervisor field to the SupervisorHidden column. Notice that I chose to create a new column in this library as opposed to selecting an existing column:
Step 3: Create a simple SharePoint Designer workflow to copy values
Create a workflow in SPD, and make sure you choose to fire the workflow every time the item changes. Next, select the “Set Field in Current Item” action. Set the Supervisor column to the SupervisorHidden column in our list. Finish the workflow.
Step 4: Create a new form
Once you create a form and save it to the form library, the workflow will fire and the value that was promoted to the SupervisorHidden column will be copied into the Supervisor Person field. Simply hide the SupervisorHidden and the workflow columns from your views, and you’re all set!
