Microsoft Power Apps, SharePoint, & Microsoft 365 Consulting Company

Managed Metadata Columns – How to Update

SharePoint has a Managed Metadata Service which is one of the biggest draws for using the service. For those unfamiliar with it, Managed Metadata Service allows administrators to establish a universal set of terms and categories that can be used for everything from tagging documents to setting your navigation. But many users run into roadblocks when using Managed Metadata columns in workflows. Due to the flexible nature of the feature, it’s not as simple as “Set column as X.” Below, we’ve listed a guide to help you.

Understanding Managed Metadata as a feature

For many general workflow users, setting a column value is fairly simple in SharePoint Designer. Whether it be a choice field, a single line of text, or a date field, it’s pretty self-explanatory. But with Managed Metadata, what you see isn’t what you get.

One of the features of MMS is the ability to add secondary labels. So if one person calls it a “PowerPoint” and another calls it a “briefing” and yet another one calls it a “deck,” you can use all these words to describe the same type of document. But in order to get this feature, MMS has to use a hidden field to signify that a deck is a briefing is a PowerPoint.

Getting the Real Name

This hidden field is created automatically when you create a new MMS column. So if you name your column DocumentType, SharePoint will create DocumentType_0. But you won’t be able to merely set a column here either—you’ve got to use the Call HTTPS Web Service function instead and use the hidden field internal name of the column.

To get the hidden field internal name for the column, visit the following URL in your browser: [Your Site URL]/_api/web/lists/getbytitle(‘listtitle’)/fields.

  1. Search for the column name (DocumentType_0 in our example) and find the name.
  2. Get the List Item Type. You’ll be looking for the d:ListItemEntityTypeFullName element.
    • [Your Site URL]/_api/web/lists/getbytitle(‘listtitle’)
  3. Next, you’ll need to visit your Term Store Management page under Site Settings and locate the unique identifier and default term name. You’ll find both of these at the bottom of your general settings for the term you want to use.

 

Creating the Dictionaries

  • Back in SharePoint Designer, the first thing you’ll need to do is Create a Dictionary to store some headers. All of these will be String type.

 

Variable Name: Headers

Name Type Value
Accept: String application/json;odata=verbose
Content-Type: String application/json;odata=verbose
Content-Length: String <length of post body>
X-HTTP-Method: String MERGE
If-Match: String *

 

  • Next, create a second dictionary for the metadata. It will contain one entry, also as a String.

 

Variable Name: Metadata Dictionary

Name Type Value
type String SP.Data.TaxonomyListListItem

 

  • Finally, there’s one more dictionary, which will contain request data. Note the two underscores under the first entry

 

Variable Name: Data

Name Type Value
__metadata Dictionary Variable: [Metadata dictionary we created above]
[Use the hidden column name GUID here] String [Default Term Name]|[Unique identifier]

 

 

Call the SharePoint REST service

Now that we’ve got our dictionaries set, it’s time to call the REST service to update the taxonomy field.

  • Add a “Call HTTP web service” action to the workflow, and use the following in string builder to create a dynamic URL:

[%Workflow Context: Current Site URL%]_api/web/lists/getbytitle(‘[%Workflow Context: List Name%]’)/items([%CurrentItem:ID%])

  • Set the HTTP method to HTTP Post.
  • Under the Properties, you’ll need to set the Request Headers to the Headers dictionary (first dictionary) and the Request Content to the Data dictionary (third dictionary).
  • Save and you’re set to go!

 

If you would like us to help you get ahead in migrating to SharePoint 2019, send us a message and we will gladly talk anytime. We’d love to chat! 1-800-682-0882 or submit an inquiry here