March 23, 2016

Error when opening an inactive entity

After migrating from CRM 2015 to CRM 2016 I experienced strange behavior at some inactive entities. Immediately after opening it I got an error:

The object cannot be updated because it is read-only

Wait what? I did not change any data! Why this error? Disabled all javascript, disabled all plugins, the error was still there.

We introduced business process flow some months ago in this entity. The old entities had no process and stage ID defined. CRM 2016 wants to fix this immediately when dealing with an entity that has no process or stage defined and sets the default values.

But there is a bug in CRM. The update is made on inactive entities as well. Thus the error.

The only solution is to update the values directly in the database: 

UPDATE ENTITY SET ProcessId = PROCESSGUID , StageId = STAGEGUID  WHERE (ProcessId is null or StageId IS NULL) AND StateCode = 1