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

  • 25 June 2015
  • 5 replies
  • 34 views

Badge +2

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


5 replies

Badge +2

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)

Badge +2

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

Badge

Hi Robert can you clarify the Body input?

Badge +2

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

Badge +2

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

Reply