If you’ve read my blog post on using content types to modify your NewForm.aspx and EditForm.aspx pages, you know how fond I am of using SharePoint Designer workflows to flip the values in my Content Type fields. Since content types control which fields are displayed on your forms, they provide an easy way to customize the input forms for your lists and libraries. The trick is building SharePoint Designer workflows that automate the transitions between your content types. By flipping the value in your Content Type field via workflows, you make your list and library forms look dynamic–all without the effort of building custom ASPX pages.
Unfortunately, I hit a major snag this week while trying to modify the Content Type field in a reusable workflow in SharePoint Designer 2010. No matter how I set up my reusable workflow (e.g. assigning the workflow to work with one content type or ALL content types), I couldn’t use the Set field to… action in SharePoint Designer to reset the value in my Content Type field. Neither the Content Type nor the Content Type ID field appeared in the list of columns I could select to update. And I couldn’t add the Content Type or Content Type ID field as Associated Columns either.
I did some research, talked with a few smart folks and finally figured out why the Content Type field cannot be modified via a reusable workflow. Unlike “normal” list workflows, reusable workflows aren’t tied to a specific document library or list when they are created. Reusable workflows are built and published independently so they can be ported–or assigned–to any of your site collection’s libraries or lists. Unfortunately, the portability that makes the reusable workflows so useful also inhibits the workflow’s ability to modify the Content Type field.
When you associate a content type to a document library or list in SharePoint, the document library or list sees and recognizes the new content type’s ID. Because it knows the content type IDs that are associated to your list/library, SharePoint Designer allows you to query against the content type and update it via a workflow. Reusable workflows aren’t associated with document libraries or lists until after they’re published. As a result, SharePoint Designer can’t see or obtain any relevant content type ID(s) during workflow creation. This is why SharePoint Designer locks out the Content Type and Content Type ID fields from being updated via reusable workflows.
The only ways I’ve found to work around this issue are:
- Use list workflows instead of reusable workflows.
- Use reusable workflows, but leave out the Content Type field flipping. Your users will just have to reset the Content Type field by hand.
Anyone have additional ideas?