0

I'm trying to update a multi-value lookup field in a SharePoint 2013 list from a SharePoint designer workflow using the 'Call HTTP Web Service' action.

Here's how the field looks when querying a list item with two values:

    "Assigned_x0020_toId":{"__metadata":{"type":"Collection(Edm.Int32)"},"results":[1,2]}

I'm using nested dictionaries to create the json structure for the POST request within SharePoint Designer but I'm not sure how to create a JSON array as needed by the "results" field.

I'm reading the "Assigned to" field from another list into a workflow variable typed as "Lookup Ids, comma delimited".

I then create a dictionary with an item "results" and the value set to my comma delimited lookup ids variable.

The json this produces is:

    "Assigned_x0020_toId":{"results":1}

I get the following error when executing the query:

An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartArray' node was expected.

I think that's because the query should be:

    "Assigned_x0020_toId":{"results":[1]}

Can anybody help me achieve that in SharePoint designer or suggest a better alternative?

The reason I'm using the web service is that I'm trying to create a workflow that loops through all of a list's items updating values when changes are made in another list.

  • "Assigned_x0020_toId":{ 'results': [1] } This should work. – Steve Curran May 30 '15 at 1:40
  • thanks Steve but is there any way to create that in SPD 2013? – user21251 Jun 26 '15 at 10:45
0

I know it's been some time, but here's how you can build this in SharePoint Designer:

  1. Start with a string, and set it to the array you want. (i.e. thisArray, type String, value [1])

  2. Then Build a Dictionary as a single item. (i.e. thisDictionary, type Dictionary; Add results, type Dictionary, value Variable:thisArray. SPD will default the "Return field as" to "As Dictionary from JSON")

  3. In your payload dictionary, assign Assigned_x0020_toId, type Dictionary, value thisDictionary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.