cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
LeewoC
Level: Powered On

Error 400 trying to create new SharePoint List Item

I want to write a flow that will create a new list item for each department in our organisation. 

 

There are 27 departments (at the moment) but that could change.

 

I could create 27 individual "Create Item" actions, 1 for each department but this doesn't seem very efficient and would have to be manually changed every time we added or removed a  department.

 

Trying to be more efficient I created a separate list called "Departments" and set the Department field on my new list to be a lookup of "Departments".  The lookup single item only.

 

I wrote a flow to get the "Departments" list and used 'Apply to each' to step through and create a new list item for each department returned.

 

However the flow fails when it tries to create a new list item and I'm not sure why.  I'm pretty new to flow so it's probably  my doing something wrong or taking the wrong approach but I really can't figure out what's happening.

 

The item data looks OK as far as I can tell (see below)

 

{
  "Title": "RS0001",
  "Does_x0020_the_x0020_Hazard_x002": {
    "Value": "YES",
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
  },
  "Are_x0020_Mitigating_x0020_Measu": {
    "Value": "NO",
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
  },
  "Are_x0020_the_x0020_Mitigating_x": {
    "Value": "NO",
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
  },
  "Number_x0020_of_x0020_Actions_x0": 0,
  "Number_x0020_of_x0020_Actions_x00": 0,
  "Status": {
    "Value": "Red",
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
  },
  "Department": {
    "Id": "AFCO",
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
  },
  "{ContentType}": {
    "Id": "0x0100FDBB848DFA381048978071668525AA54",
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedContentType"
  }
}

 

but the create item operation keeps crashing out with Status Code 400 and the following data

{
  "status": 400,
  "message": "A value must be provided for item.\r\nclientRequestId: 9e4629e5-867d-4088-9eda-70812d020381",
  "source": "sharepointonlineconnectionprovider-northeurope.db3-ase-001.p.azurewebsites.net"
}

Can anyone tell me what's going wrong?

 

Thanks in Advance

1 ACCEPTED SOLUTION

Accepted Solutions
LeewoC
Level: Powered On

Re: Error 400 trying to create new SharePoint List Item

I managed to figure out the problem!

 

I was trying to pass in the department name, but create item was expecting the ID of the "Departments" list item.

 

I updated the create item action to use the ID from my get departments action and everything works as expected.

 

3 REPLIES 3
LeewoC
Level: Powered On

Re: Error 400 trying to create new SharePoint List Item

I managed to figure out the problem!

 

I was trying to pass in the department name, but create item was expecting the ID of the "Departments" list item.

 

I updated the create item action to use the ID from my get departments action and everything works as expected.

 

npatelAU
Level: Powered On

Re: Error 400 trying to create new SharePoint List Item

I have a similar issue but a different situation. I am passing value from Microsoft form response where one of the questions has multiple responses and that link to allow multiple values enable choice column when I create an item in SharePoint. I tried to convert that question response to JSON but it did not work. from your reply, I guess I am also missing passing ID value. can you show your flow screen for me to get more help on how to get an ID for that list?

mestevez01
Level: Powered On

Re: Error 400 trying to create new SharePoint List Item

Could you please explain how the Get Departments action works? I have a similar situation. Thanks in advance!

Helpful resources

Announcements
firstImage

Microsoft Flow Online Conference

Join us for a FULL day of FREE Microsoft Flow Sessions from some of the best minds in the industry!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 177 members 5,457 guests
Please welcome our newest community members: