Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Copy a list item using REST API - choice field with multiple selections allowed - why is this so difficult?

(0) ShareShare
ReportReport
Posted on by 12

HELP! I'm trying to copy a list item from one list to another using the SharePoint REST API... I'm using the API because the Flow is configured in such a way as to support multiple sites containing that "same" list.

The list has a Choice field with multiple selections allowed (a checkbox), but I have yet to figure out how to structure the JSON for posting the item to the destination list... 

 

I've tried several things such as creating the item then updating it with the choice field (Flow runs and never seems to complete) and also adding the selected choices to the "body" to input to the REST API as a single delimited string (example "Designation":"Oak Street;#Pine Street;#Willow Street").  The latter gives the error "BadGateway" with the message "

Invalid choice value.\n\nA choice field contains invalid data. Please check the value and try again."
 
I have search the Internet in vain for any "official" documentation of how to do this with finding any useful results. Any help is greatly appreciated.
  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at
    Re: Copy a list item using REST API - choice field with multiple selections allowed - why is this so difficult?

    @M_Ott  i am glad that you figured it out and solution worked for you.

  • M_Ott Profile Picture
    12 on at
    Re: Copy a list item using REST API - choice field with multiple selections allowed - why is this so difficult?

    @annajhaveri Actually that was it!  I was using site content types for my two lists and I *thought* I had changed the site column but had not actually checked it.  The site's admin had changed the choice field at the list level to allow multiple selections which was confusing things.  After I changed to site column in question, your code did indeed work.  So, I'm both relieved and disappointed in myself at the same time!

    The moral of the story is ALWAYS CHECK YOUR INPUTS

  • M_Ott Profile Picture
    12 on at
    Re: Copy a list item using REST API - choice field with multiple selections allowed - why is this so difficult?

    Yes, it is multiple choice.. here's a screen cap of the edit form showing the choices and the two items that have been selected.

    M_Ott_0-1631625320942.png

     

  • annajhaveri Profile Picture
    8,531 Most Valuable Professional on at
    Re: Copy a list item using REST API - choice field with multiple selections allowed - why is this so difficult?

    @M_Ott  can you please double check if your choice field is multi valued, i had got the same error when my choice field was not multi valued.

  • M_Ott Profile Picture
    12 on at
    Re: Copy a list item using REST API - choice field with multiple selections allowed - why is this so difficult?

    So I tried that ... when I try to create my list item on the target list I use:

    {
     "__metadata": {
     "type": "SP.Data.@{variables('TargetList')}ListItem"
     },
     "Title": "@{variables('ItemTitle')}",
     "Submittal_x0020_Type": "@{variables('SubmittalType')}",
     "Submittal_x0020__x0023_": "@{variables('SubmittalNum')}",
     "Submittal_x0020_Version": "@{variables('SubmittalVersion')}",
     "Contract_x0020_Item_x0020_Number": "@{variables('ContractItemNumber')}",
     "Specification_x0020__x0023_": "@{variables('SpecificationNum')}",
     "SubmittalStatus": "@{variables('Status')}",
     "Submittal_x0020_Comments": "@{variables('Comments')}",
     "Discipline": "@{variables('Discipline')}",
     "Designation": {
     "__metadata": {
     "type": "Collection(Edm.String)"
     },
     "results": @{variables('Designation')}
     },
     "Submitted_x0020_ById": "@{variables('SubmittedByID')}"
    }

    where the variable designation is an Array

    I get the following error

    Incompatible type kinds were found. The type 'Collection(Edm.String)' was found to be of kind 'Collection' instead of the expected kind 'Primitive'.

     

    If I remove the __metadata bit like so:

     

    {
     "__metadata": {
     "type": "SP.Data.@{variables('TargetList')}ListItem"
     },
     "Title": "@{variables('ItemTitle')}",
     "Submittal_x0020_Type": "@{variables('SubmittalType')}",
     "Submittal_x0020__x0023_": "@{variables('SubmittalNum')}",
     "Submittal_x0020_Version": "@{variables('SubmittalVersion')}",
     "Contract_x0020_Item_x0020_Number": "@{variables('ContractItemNumber')}",
     "Specification_x0020__x0023_": "@{variables('SpecificationNum')}",
     "SubmittalStatus": "@{variables('Status')}",
     "Submittal_x0020_Comments": "@{variables('Comments')}",
     "Discipline": "@{variables('Discipline')}",
     "Designation": {
     "results": @{variables('Designation')}
     },
     "Submitted_x0020_ById": "@{variables('SubmittedByID')}"
    }


    I get this error

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



     

  • Verified answer
    annajhaveri Profile Picture
    8,531 Most Valuable Professional on at
    Re: Copy a list item using REST API - choice field with multiple selections allowed - why is this so difficult?

    @M_Ott  please follow below steps to update multi valued choice field using REST API

    1. In your browser, first browse to https://<siteurl>/_api/lists/getbytitle('<listtitle>')?$select=ListItemEntityTypeFullName

    Replace <siteurl> with your site url and replace <listtitle> with your list title. This will show result in your browser, take the value that is between <d:ListItemEntityTypeFullName> tag. In my case it is SP.Data.ProjectsTestListItem

     

    2. Now configure the "Send an HTTP request to SharePoint" as shown below

    annajhaveri_0-1631446349505.png

     

    Uri: _api/Web/Lists/getByTitle('ProjectsTest')/Items(1)

    Replace ProjectsTest with you list title and replace 1 with your item id which you want to update

     

    Provide the all the header values as shown in screenshot

    Provide below json in body parameter. Replace SP.Data.ProjectsTestListItem with your text that you have from the step 1. Replace choice values with your choice options that you want to save.

    {
     "__metadata": { type: "SP.Data.ProjectsTestListItem" },
    "Multichoice":
    {
    "__metadata":{"type":"Collection(Edm.String)"},
    "results":["Choice 1","Choice 2","Choice 4"]
    }
    }

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1