SharePoint lists and document libraries can have their views filtered to only show items that relate to the current user if the [Me] filter is applied to a "Person or Group" column. When creating a form in InfoPath, it would be nice to be able to put usernames into a SharePoint Person or Group column to take advantage of this filter, but you cannot do that directly. A workaround is below...
The first thing required is to capture the usernames into a text field in InfoPath. They must be in a semicolon delmited string.
When publishing the form to SharePoint, make sure that column is also published as part of the content type.
In SharePoint, create your list with the content type from the InfoPath form, and add 2 more columns to it. One is a "Person or Group" column, set to allow multiple selections and People only. Check to add this one to the content type. The other is a single line of text column. Do not add this one to the content type.
Finally launch SharePoint Designer and open your site. Create a new Workflow for your list or document library that runs on adds and changes.
The Condition will be to check that the InfoPath text field "not equals" the SharePoint text field.
The Action is to Update Item in the list. Make the Person or Group field equal the InfoPath text field, and the make the SharePoint text field equal the InfoPath text field.
Basically what this does is use a workflow to copy the InfoPath text field with the usernames in it into the Person or Group field in SharePoint. As long as they are semicolon delmited and the usernames are in the SharePoint profiles this should work. The SharePoint text field saves the current value of the InfoPath text field, so if the list of usernames in InfoPath changes the workflow will know and re-run.
Thursday, November 13, 2008
Subscribe to:
Posts (Atom)