Update Managed-Metadata fields using Nintex workflow

In this post, I will explain how a managed metadata field can be updated using Nintex workflow. At first glance, it looked pretty straightforward to me to update it by using ‘Update an item” nintex action but its not the case. If you use “update an item” action then you willn’t get any error but the field willn’t be updated. It is important to understand that for each managed metadata column, the list has two seperate columns.

As an example, I have a managed metadata property named “Primary Category”.

 

This list has two seperate columns –

1. One is a Taxonomy field type with the name of the managed metadata property, in our case PrimaryCategory

  1.                 When reading this value it is in the fomat: Name of term|GUID of term
  2.                 For example: Engineeering|6154607f-c48e-4583-bc0e-3603e521537c

2. The other is a Note type and has a internal name which is just a GUID. You can read the internalname using powershell or using javascript CSOM if you dont have access to sharepoint server.

In order to update this value we have to set both fields. The format to set these is:

Field Type Format Example (no spaces!)
Taxonomy field -1;#Name_of_term|GUID_of_term -1;#Engineeering|6154607f-c48e-4583-bc0e-3603e521537c
Note field Name_of_term|GUID_of_term Engineeering|6154607f-c48e-4583-bc0e-3603e521537c

Before calling the webservice, store these values in workflow variables.

  • txtTermFull stores the value read from the managed metadata field (Name_of_term|GUID_of_term)
  • txtTermFullMinus1 is populated from a Build String action with a value of (no spaces!): -1;#Name_of_term|GUID_of_term or also -1;#{WorkflowVariable:txtTermFull}
  • You will also need the item ID of the item you will be updating, in this case store it in itemId.

The web service call in the source editor should look like this –

<?xml version=”1.0″ encoding=”utf-8″?> <soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:m=”http://schemas.microsoft.com/sharepoint/soap/”>   <soap:Header>   </soap:Header>   <soap:Body>     <m:UpdateListItems>       <m:listName>YourListName</m:listName>       <m:updates>         <Batch OnError=”Continue” ListVersion=”1″ ViewName=””>           <Method ID=”1″ Cmd=”Update”>             <Field Name=”ID”>{WorkflowVariable:itemId}</Field>             <Field Name=”PrimaryCategory”><![CDATA[{WorkflowVariable:txtTermFullMinus1}\]]></Field>             <Field Name=”someGUID_GetUsingPowershell”><![CDATA[{WorkflowVariable:txtTermFull}\]]></Field>           </Method>         </Batch>       </m:updates>     </m:UpdateListItems>   </soap:Body> </soap:Envelope>

So, that’s it, a pretty straight forward way of setting a managed metadata field in Nintex workflow.

If your managed metadata field is enabled to have multiple values then values should look like this –

The full term value:

Construction|543622c3-8542-40af-9f01-9129c1cc2917;Corporate|7b21c2ea-b994-4c64-8b43-78b05464b0f8;Employee Development|ed96010a-04ba-4e17-b4f8-6ee5b72fde05

The full term minus 1 value:

-1;#Construction|543622c3-8542-40af-9f01-9129c1cc2917-1;#Corporate|7b21c2ea-b994-4c64-8b43-78b05464b0f8-1;#Employee Development|ed96010a-04ba-4e17-b4f8-6ee5b72fde05

The only way to set these values in Nintex is with a Call web service action and leveraging the SharePoint Web Services.

 

Trackbacks

Leave a Comment

Your email address will not be published. Required fields are marked *