cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting or Updating a Managed Metadata field using Nintex Workflow

Automation Master
Automation Master
8 34 10.5K

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.

 

34 Comments
murphybp2
Nintex Newbie

What does the data in your variable vTextBusinessUnitMM look like before you run the RegEx?  I'm using SharePoint 2013 (it appears you're using 2010), and when I get the value from my MM column, it doesn't contain the IDforTerm information.  Is this a a change between 2010 and 2013?

Automation Master
Automation Master

Let me test on 2013 and let you know.

Not applicable

I have trouble in 2013 too,is there some solution?

Automation Master
Automation Master

OK so i have had a play in 2013 to see how to do this.  For the test i had the following set up:

  • Site 1:  List with title field and managed metadata field (term set Organisation) called "Business Area"
  • Site 2:  List with title field and managed metadata field (term set Organisation) called "Organisation"

Requirement:

  • to have a workflow on site 1 list that would enter same term into site 2 list

The above works for 2010.  Here is what I did for 2013:

  1. workflow on site 1 list
  2. query TaxonomyHiddenList site 1 for "IdForTerm" (vTextIdForTerm) and "Title" (vTextTermTitle) where "Term" is value in list
  3. query TaxonomyHiddenList site 2 for "ID" (vIDDestinationTerm) where "IdForTerm" = vTextIdForTerm
  4. Build string vIDDestinationTerm;#vTextTermTitle|vTextIdForTerm (vTextUpdateTermValue)
  5. Create item in another site and use vTextUpdateTermValue
alexandredavid
Nintex Newbie

your solution works only if you have unique labels for terms but it is almost never the case in all farms. What if have multiple terms "terms" in multiple termsets ? How do I get the GUID of the term if I have only the label (stored in the field and accessible with nintex workflow) ?

Automation Master
Automation Master

can you leverage full path?  and use that to compare in taxonomyhiddenlist?

alexandredavid
Nintex Newbie

Cassy,

Even if I can do that imagine I've the following :

Countries

    France

    Switzerland

    Sweden

    ...

Keywords

   France

   Sweden

   ...

Considering taxonomy HiddenList is used for the whole site collection, if I have a Field pointing to Coutries and another pointing to Keywords, I'll have the same path, same title etc. in the TaxonomyHiddenList for 2 différents terms.

alexandredavid
Nintex Newbie

if I want to update an item from a site A to a Site B with managed metadata fields, in source field values I get something like :

"ID;Term"

my solution is :

the ID is corresponding to the ID in the TaxonomyHiddenList, instead of querying this list with the label i'll query it with the ID to get the GUID of the term. The ID is unique in the sitecollection, the Guid is unique in the whole Farm.

Then the update is done via webservice on 2 Fields "MyFieldName" + the associated hidden note Field StaticName.

I get the staticName calling webmethod "getlist" in list.asmx and querying XML result.

I can post more here or create a blog post if necessary but Nintex should really provide an action to update an item in another site or to get ManagedMetadata Guids easily.

chamblee
Nintex Newbie

If I use Update Item and pass in a variable containing the GUID, it doesn't work. I get the following error

"The workflow could not update the item, possibly because one or more columns for the item require a different type of information."

But if I pass in the GUID directly rather than stored in a variable, it does work. 

Any ideas why?

vs.

Automation Master
Automation Master

are you sure your variable "txtIdForTerm" has the same value as what you are entering directly?

chamblee
Nintex Newbie

Yes. I logged it to the Workflow history to make sure.

schneika
Nintex Newbie

Is it in principle possible to set Multivalue Managed Metadata Columns with NINTEX Workflow?

Automation Master
Automation Master

Hi Cassy Freeman

My experience.

Using SP 2010, I was able using only ID;#Value to ADD the managed metadata to a NEW column using a Call Web Service Action (Not Update Item, not Set Field Value)

I was not able to UPDATE this target column, even if I remove the value from this target column.

In your scenario, do you update also your target column?

I begin to understand why there is no such action ...

Regards,

Christophe

Automation Master
Automation Master

Hi ‌ - it was a long time ago now I am struggling to remember but I believe I was adding not updating.

Automation Master
Automation Master

Thanks for your feedback. I did not find anybody able to update a managed metadata with Nintex or SharePoint Designer.

annhwallinger
Nintex Newbie

My colleague and I were able to figure this out a bit easier. In the action that creates the item in the destination we simply used this syntax:

-1;#[MMfield_0]

or example if your Managed Metadata field is called 'DocType' it would be:

-1;#DocType_0

I couldn't really tell you why it works but it does! The DocType_0 will be in the format TermLabel|TermGuid. I don't get the -1 but it makes the magic happen.

Automation Master
Automation Master

Hi ‌,

Does it also work for Updating the Managed Metadata?

annhwallinger
Nintex Newbie

That is what I am using it for. Creating and updating. Haven't figured out how to null out an existing field yet but haven't really tried b/c my fields are required anyway so far. It saved me about 16 steps of workflow building soap responses and whatnot.

Automation Master
Automation Master

Hi,

Where do you set -1;#DocType_0 ?

I have tried in a Build String Action without success.

Thanks,

annhwallinger
Nintex Newbie

I've used it in a couple of places but for example I put it directly in an O365/Nintex action to create an item in another site collection. Rather than select a variable or build a string first I just put it directly into that action and shockingly it worked.

Automation Master
Automation Master

That is what I feared, I cannot select this Item_0 as it is not available in the list of item :-( on premise 2010

Or maybe I need to create one?

kjhawkins
Nintex Newbie

In your Query, is the List ID the ID of the TaxonomyHiddenList?  If yes, how did you get the ID?

<Query>

  <Lists>

    <List ID="{0x0100F91D8395C2F2A34EB7D163EFA6D2C762}" />

  </Lists>

<ViewFields>

<FieldRef Name="IdForTerm"/>

<FieldRef Name="ID"/>

</ViewFields>

<Where>

<Eq>

<FieidRef Name="IdForTerm"/>

<Value Type="Text">{WorkflowVariable:vDocCategoryValue_txt}</Value>

</Eq>

</Where>

</Query>

Automation Master
Automation Master

Can you navigate to the taxonomyhiddenlist and go list settings - the ID is in the URL.

kjhawkins
Nintex Newbie

That worked! Thank you.

kjhawkins
Nintex Newbie

Cassy,

How can you get the List ID of the TaxonomyHiddenList via workflow?

Regards,

Ken

Automation Master
Automation Master

You could use web service call _vti_bin/lists.asmx > GetList supply in "TaxonomyHiddenList" and get ID from result?

kjhawkins
Nintex Newbie

I'll give that a go.  Thanks for the response!

nintexbadger
Nintex Newbie

I'm not sure why this hasn't already been mentioned or maybe I'm just not understanding the original post, but if you want to create/copy/update managed metadata from one list into another it's much simpler than what I'm seeing above.

In my example below Specific Location is a Managed Metadata column.

Just set a single line of text variable using the Current Item List Lookup:

Then use Update Item or Create Item action to insert/update:

If you take a look at the value that is returned using list lookup you'll see the GUID is being pulled back so that's why this works:

Automation Master
Automation Master

Is that in the same site though? What about a different site collection? 

nintexbadger
Nintex Newbie

I am using the Create item in another site action:

I am taking it from a sub-site and creating an item in the top level site. 

I have not personally tested against a different site collection but the option is there if you need it.  I would assume if it doesn't work then yes you would probably need to use a web service action.

Automation Master
Automation Master

Yes the values of the terms from site collection to site collection 

Automation Master
Automation Master

Hi,

Thanks for your feedback.

I have retried it in 2010 and I confirm it is not the case. It returns only the value.

In which environment are you running your workflow?

Regards,

Christophe

nintexbadger
Nintex Newbie

This was on SharePoint 2013 On Premise.

nanettedv
Nintex Newbie

Hi Ann

This works well, but I have only been able to get it working when creating a new item, but not when updating an item. So this (Office 365 Upload file) works:

but not this (Update List Item):

Strange...