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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans