EntityState must be set to null, Created or Changed CRM error

Hello everyone,

If you are working with an update plugin and got this “EntityState must be set to null, Created (for Create message) or Changed (for Update message) when attempting to update an entity” error you are in the right place to solve this problem.

Just like me probably you might have used Update method of CrmService class to update your record while you are still processing the update operation.

Here is how it looks:


Instead of this usage you should use UpdateObject method of your OrganizationServiceContext like this:


Here comes an important situation. To Avoid Multiple Trigger Of Same Update Plugin you should use a codeline like below at the beginning of your Execute method of your update plugin:

if (localContext.PluginExecutionContext.Depth > 1)

Hope this helps!

See you 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *