I'm working on a SharePoint 2013 publishing approval workflow that needs to compare if a managed metadata field in a newly created item is set to a specific value. This in order to assign a task to a sharepoint group if the condition is true. I'm having difficulties in finding the value of the MMD field. I've tried to do it in the Term|GUID-way(Term|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). But I don't get any values at all.

If anyone has some pointers or advice on this issue, it would be great!

Thanks, Joakim


Here is a snippet that I have used to set the values in a TaxonomyField in SharePoint 2010.

However the object model hasn't changed too much in this area:-


This code is expecting an SPListItem object to be passed through.

string labelValue = String.Empty;
TaxonomyField field = item.Fields.GetField(fieldName) as TaxonomyField;
string fieldValue = item[field.Id].ToString();

TaxonomyFieldValue taxonomyFieldValue = new TaxonomyFieldValue(field);
string fieldValue = item[field.Id].ToString();
if (fieldValue.Contains("|"))

labelValue = taxonomyFieldValue.Label;

You can now compare the value inside labelValue with the value you need to check.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.