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

Community site session details

Session Id :

[Resolved] – EntityState must be set to null, Created (for Create message) or Changed (for Update message)

Community member Profile Picture Community member

Recently I was facing an issue with Update of a record in the Plugin. The error message was as ‘EntityState must be set to null, Created (for Create message) or Changed (for Update message)’.

The plugin was written on Post-Operation of Create action.

After looking for the resolution for the issue, I came across a solution posted online, which I am not sure, is supported, but worked for me.

Before calling the _service.Update(Entity), You need to change the state of entity as below:

recordToUpdate.EntityState = EntityState.Changed;

Hope this helps.

Also there is another approach to resolve this:

Instead of using

context.Update(object),

Use:

context.UpdateObject(object)

Reference:

http://stackoverflow.com/questions/6187978/entitystate-must-be-set-to-null-created-for-create-message-or-changed-for-u



This was originally posted here.

Comments

*This post is locked for comments