web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

OData Updating an Entity - Returning 400 Bad Request

(0) ShareShare
ReportReport
Posted on by

Hi all,

I'm trying to update a record from an entity utilizing with the generated classes from the odata templating and code generation tool but the server is returning a 400 Bad Request:

I'm updating the entity in a fashion similar to this 

var entity = context.ConsItemPrices.Where(x => x.ItemId == "value").First();

entity.PropertyName = "some value";

context.UpdateObject(entity);

context.SaveChanges();

This pattern works for almost any other entity except for this one.  It should be important to note that this is a custom entity that it's Primary Key consists of simple types and a custom enum which was set as Nullable = true.  Before generating the classes from the $meta data file, I had to tweak the key to make the enum into a string and also make it nullable = false so that I could even read the entity set from the Odata endpoint.  I have a feeling that it might be the cause of the update failure. 

Any thoughts or ideas are more then welcome.

Thank you.

*This post is locked for comments

I have the same question (0)
  • Mohsin Khalid Profile Picture
    501 on at

    Hi tek9iner;

    Check if the entities public property is set to Yes.

  • Amir Nazim Profile Picture
    5,994 on at

    try to share exception log or inner message, 400 error bad request is to generic error.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans