cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

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
Helper I
Helper I

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.

 

View solution in original post

4 REPLIES 4
Helper I
Helper I

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.

 

View solution in original post

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?

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

Thanks for your advice 🙂

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (10,997)