Topic
How to dynamically update a Managed Metadata field in SharePoint Online using a Nintex workflow.
Instructions
Note: Create all variables for use later.
- Open the workflow designer.
- Add a Regular Expression action to extract the label of the MMD field. Configure the action as follows:
- String: {Current Item: MMD FIELD BEING COPIED_0}
- String Operations: Replace
- Pattern: |(.*)
- Replacement String:
- Output: MMDLabel
- Add a Regular Expression action to extract the GUID of the MMD field. Configure the action as follows:
- String: {Current Item: MMD FIELD BEING COPIED_0}
- String Operation: Replace
- Pattern: ^(.*[\|])
- Replacement String:
- Output: MMDGuid
- Add a Build Dictionary action to the workflow. Configure the action as follows:
- Key: Accept
- Type: Text
- Value: application/json;odata=verbose
- Output: requestHeaders ?
- Add a Call HTTP Web Service action to the workflow. Configure the action as follows:
- Address: {Workflow Context:Current site URL}/_api/contextinfo
- Request Type: HTTP Post
- Request Headers: requestHeaders (this is the variable set in step 3)
- Request Content:
- Response Content: responseContent
- Response Headers:
- Response Status Code: responseStatusCode?
- Add a Get An Item From A Dictionary action to the workflow. Configure the action as follows:
- Dictionary: responseContent (this will be the variable set in step 5)
- Item Name or Path: d/GetContextWebInformation/FormDigestValue
- Output: FormDigestValue
- Add a Web Request action to the workflow. Configure the action as follows:
- URL: {Workflow Context:Current site URL}/_api/Web/Lists/getbytitle('yourList')/items(1)
- Method: POST
- Content Type: application/json;odata=verbose
- Header name (key): X-RequestDigest
- Header value: {Variable: FormDigestValue} (this will be the variable set in step 6)
- Header name (key): IF-Match
- Header value: *
- Header name (key): X-HTTP-Method
- Header value: MERGE
- Body: Content
{{"TargetMMDColumn":{{"__metadata":{{"type":"SP.Taxonomy.TaxonomyFieldValue"}},"Label":"{Variable:MMDlabel}","TermGuid":"{Variable:MMDGuid}","WssId":"-1"}},"__metadata":{{"type":"SP.ListItem"}}}}
- Username: FILL USERNAME HERE
- Password: Value: **********