Fixed – EntityState must be set to null, Created (for Create message) or Changed (for Update message) exception in Dataverse / Dynamics 365


This article discusses an error that occurs when trying to update a record in Dataverse or Dynamics 365. The error message states that the EntityState must be set to null, Created, or Changed. The error occurs when the OrganizationServiceContext tries to update an entity that has not been marked as modified. The article provides two solutions to resolve this error: using the UpdateObject method followed by SaveChanges, or creating a new Entity object for update. Sample code is provided for both solutions.


Article 7m

Login now to access my digest by 365.Training

Learn how my digest works
Features
  • Articles, blogs, podcasts, training, and videos
  • Quick read TL;DRs for each item
  • Advanced filtering to prioritize what you care about
  • Quick views to isolate what you are looking for right now
  • Save your favorite items
  • Share your favorites
  • Snooze items you want to revisit when you have more time