Inserting or Updating a Managed Metadata field using Nintex Workflow

8 34 16.9K

I had these notes stored from a couple of years ago - they helped me at the time with a problem I had been banging my head with for ages, but I haven't needed to use them since.  Not sure if any use to anyone, but in the process of getting all my blog posts in one place, and what better place than the Community

Believe it or not, this is not straight forward.  For this blog I will paint the picture.  I have a request list which uses Managed Metadata to store Business Units.  I have a list on another site which stores approved and completed items from the original request list.  On this list, the same Business Unit Managed Metadata column is used.  I tried using the "Create item in another site" action in Nintex Workflow but could not just simply map the field from one list to the other.  Instead I had to query the TaxonomyHiddenList of the target site collection to get the ID and GUID for the term.  To find the hidden taxonomy list, simply use "Lists/TaxonomyHiddenList/AllItems.aspx" on the end of your URL after the site collection.

There can be multiple terms for the same value in the TaxonomyHiddenList (if it exists in a few of the term stores), so you need to be able to pass the IdForTerm in when querying the list which is achieved by using a regular expression action.

Firstly I use the Set Variable action to store the value from the managed metadata field in the original list into a variable.  In this example I called it vTextBusinessUnitMM

Then I used a Regular expression action to find the "IdForTerm".  The configuration below changes the variable value above to the format of the IdForTerm and stores it in the same variable.


 Then I use Query list to query the TaxonomyHiddenList of the target site to get the ID and the IdForTerm.  I store the returned values in variables.

Finally I use the Build String action to format the values returned:  ID;#Value|IdForTerm.  This is what needs to be passed to the destination site when inserting or updating an item with Managed Metadata field.