Thursday, July 30, 2009

Setting a Person or Group Column in SharePoint Designer Workflow

Supposedly, you should be able to set a person or group column in SharePoint as long as the cumulative updates have been applied after December of last year (the December one apparently broke it lol). In our current setup, we still aren't able to set a person or group column using a workflow. I found this here at a MSDN blog archive and it basically helps you fix this problem in your workflow.

1. In your workflow, create a new variable whose type is a "String" and call it UserID
2. Use the action "Set Workflow Variable" and set it to whichever person or group column you are using
3. Use the action "Build a Dynamic String" and use a lookup to add the "Workflow Data" -> "UserID" to the string.
4. In front of the UserID lookup, add this: -1;#
5. Use the action to either "Set a Field in the Current Item" or "Update List Item" and, when setting the person or group column, use the "Workflow Lookup"->"UserID" instead of setting them directly.

Hope that helps someone, it certainly fixed our problems.