0

I'm trying to assign the value of column AssignedTo to multiple people, using data being read from another list with the same. I currently have this working with Create Item action, which requires hard-coding the Site / List name, and am trying to transition to using a generic HTTP request action to get around this. For all other fields this works fine, but when I try to set AssignedTo, I just can't find the right structure, or any way to inspect the Create Item POST body so that I can compare.

For the Create Item action, I construct an array into a variable such as:

[
  {"Claims": "i:0#.f|membership|me@company.com.au"},
  {"Claims": "i:0#.f|membership|other@company.com.au"}
]

And that goes into the AssignedTo field in Create Item form, and it just works.

Now I set my new composed body for HTTP request to e.g.

{
  "Title": "@{variables('DocumentPath')}:@{items('Each_Stage')['RunOrder']}",
  "AssignedTo": @{variables('Claims')}
}

using the exact same array, and the HTTP POST returns: Value cannot be null. Parameter name: entitySet

I believe that for multi-fields in general you need to wrap this into an object such as:

  "AssignedTo": {"results": @{variables('Claims')}}

So I've tried that but that just gives a different error A node of type 'StartObject' was read from the JSON reader when trying to read the contents of an entity set reference navigation link; however, a 'StartArray' node was expected. I take that to mean it wants an array directly rather than this "results" object.

I've also tried both combinations but with the key AssignedToId instead of AssignedTo.

  • Array: 'StartObject' node was found ... A 'PrimitiveValue' node was expected.
  • Object {"results": .. }: 'StartObject' node was found ... A 'StartArray' node was expected.

What am I missing here? I really want to avoid doing additional lookups of user data if it can be avoided, and clearly the "Claims" data should be authoritative and usable as it is, I just can't find the right way to express it in this request.

1
  • Could you describe the source column structure and destination column structure? Are they both of type Person? For MS Flow to work, you need to use Parse JSON with schema and then get the claim and then you can assign the value to AssignedTo column. It would be helpful, if you could post a screenshot of your Flow. Nov 2, 2020 at 23:00

1 Answer 1

0

Ok, found part of the issue.. Setting "__metadata": {"type": "SP.Data.<ListName>Item"} fixes the errors, but requires "content-type" header to be set to "application-json;odata=verbose", which I hadn't been doing. Now I have a new issue - the AssignedTo field is just not getting a value, even though the request is accepted and other fields are being populated correctly. Will post as a new question as I see this as a different problem entirely.

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.