cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LeewoC
Advocate I
Advocate 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
LeewoC
Advocate I
Advocate 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
LeewoC
Advocate I
Advocate 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.

 

npatelAU
Frequent Visitor

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,606)