cancel
Showing results for 
Search instead for 
Did you mean: 

Update managed metadata with Nintex Workflow for O365 via SharePoint REST api

robertwagenaar
Nintex Newbie
2 7 2,800

As a little 'evening project' I've done some research on how to update Managed Metadata with Nintex Workflow for Office 365.

There is no pre-defined action in Nintex Workflow O365 that does this.

I've set a constraint for myself to do this with the SharePoint 2013 REST API, because the SharePoint SOAP Webservices are deprecated.

There is a lot of information on the internet that describes part of the solution, but no overall practical guide (or at least I didn't find it).

That's why I wanted to share the following practical description with the community:

There are just 4 steps you need to follow:

STEP 1: Add a 'Build Dictionary' action to your workflow

build-dictionary.png

Configure this action as follows:

build-dictionary-config.png

STEP 2: Add a Call HTTP-webservice Action

call-http-webservice.png

Configure this action as follows:

call-http-webservice-config.png

STEP 3: Add a Get an Item from a Dictionary Action

get-item-from-dictionary.png

Configure this action as follows:

get-item-from-dictionary-config.png

STEP 4: Add a Web Request action

web-request.png

Configure this action as follows:

rsz_web-request-config.png

Of course there are some improvements to make:

for instance: you should determine the type of your item, not just enter SP.ListItem

I hope it's useful for someone and I'm open to any feedback/additions/corrections

7 Comments
robertwagenaar
Nintex Newbie

Someone asked me why Nintex stores the value of the requestheaders variable like this: {"Accept":"application\/json;odata=verbose"}

For whom that may interest also:

I think that's because of the escape syntax of json. As I understand it: if you want to use the forward slash in a json-string then you have to escape it by placing a backwards slash in front of it. So this is actually Nintex helping us by escaping the / character to make it valid json.

So the following is correct json: {"Accept":"application\/json;odata=verbose"}

While this is incorrect json: {"Accept":"application/json;odata=verbose"}

Please note: don't escape the forward slash yourself, if you do, Nintex will escape it once more and the step won't work (just tested that)

robertwagenaar
Nintex Newbie

hi Julian, no problem! Thanks for keeping me posted!

julian_charles
Nintex Newbie

Hi Robert can you clarify the Body input?

robertwagenaar
Nintex Newbie

Hi Julian,

take the following example:

You have a custom list named 'customers' and you have a managed metadata column named 'country'. This managed meta data columns has the following valid values: 'United States' (8084de3c-6b07-4673-993d-fdbcb530f81d) and 'Netherlands' (11b8d923-6236-4f94-9dcb-fba989e94848). Say you want to update this 'country' column to the managed meta data value 'Netherlands'

In that case you would fill the body like this:

{'country':{'__metadata':{'type':'SP.Taxonomy.TaxonomyFieldValue'},'Label':'Netherlands','TermGuid':'11b8d923-6236-4f94-9dcb-fba989e94848','WssId':'-1'},'__metadata':{'type':'SP.ListItem'}}

Hope that helps, if you need more info, just let me know.

Greetings,

Robert

robertwagenaar
Nintex Newbie

Hi Julian,

I've seen this happen myself a few times, when the workflow ran very slowly.

Normally the validity of the FormDigestValue is 30 minutes (1800 seconds).

If the final update call takes places more than 30 minutes after retrieving the FormDigestValue, it will fail with the error you mentioned.

You can check if this is the case by adding a 'log to history' action directly after the step for getting the FormDigestValue and directly after the final update step. You can than check if there is more than 30 minutes between the two.

Can you let me know if that's the case?

Thanks,

Robert

Not applicable

Hi Robert,

How can I get the SP.ListItem in my case it am getting the FormDigest, however it is not working on Web Request. The Managed Metadata is not updating and I am getting no error while execution of the Web Request. I am hoping the issue might be on type='SP.ListItem' but not sure

Not applicable

Hi Robert,

Now I am getting this error on Web Request Action "The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your operation again.".