The Taxonomy Field Added feature is not activated on sites created using the blank site template, or sites created using custom site definitions so a good idea is to include a feature activation dependency that ensures this is activated before we attempt to provision our field.This is easy to do using the Visual Studio 2010 feature editor – just expand the Feature Activation Dependencies section at the bottom and add the following information: Title: Taxonomy Field Added Feature ID: 73ef14b1-13a9-416b-a9b5-ececa2b0604c Description: Register taxonomy site wide field added event receiver Assuming the feature that contains the site columns is site scoped this feature will activate automatically if it isn’t already activated.
I’ve also added in some additional error handling so we get informative messages if the metadata service and/or term set does not exist.
Note that if we are only creating a site column (or even a content type) this should work without completing the following steps.
At this point we have a robust way of deploying a standalone site column which is useful in certain situations but in many situations we need to provision content types, list definitions and list instances which is when things get tricky…
As explained in the previous post Issues provisioning Share Point 2010 Managed Metadata fields – to ensure the metadata field automatically appears in the search refinement panel as it does for all other managed metadata fields we need to add the Tax Catch All columns to our list definition and wire up two taxonomy event receivers.
If we inspect a list that contains a managed metadata field created through the UI it shows two event receivers.
These are the Taxonomy Item Synchronous Added Event Receiver for the Item Adding event and the Taxonomy Item Updating Event Receiver for the Item Updating event.
The specific error message you get is: Error – Failed to get value of the “” column from the “Managed Metadata” field type control. text) field that is required for the metadata column to work.
The first taxonomy field we created actually only stores a lookup value to a list within the current site collection and it is the note field that actually stores the names and Id’s of each selected term.
I find the easiest way to ensure all the columns are added to the list definition is to add them to a content type first.
This content type should contain the managed metadata/taxonomy field, the note field and the Tax Catch All and Tax Catch All Label fields as shown below.
The last issue can be easily avoided by adding a feature dependency to ensure the required feature is activated before we deploy our custom site column.