Entity.IsReadOnly RRS feed

  • Question

  • Hello, I've created an ETL app which is essentially a console app that uses the orgservice to make backend data inserts/updates. I'm currently looping through a large set of entities, and performing an update on each entity.  I'm getting the following error when I update 1 of the entities:  

    "The object cannot be updated because it is read only"

    I want to be able to identify this state ahead of time, in order to avoid exceptions.  My ETL program threw the exception above for an entity. However, a debug watch showed that the entity's read-only property had a value of false, appearing to indicate that the entity was *not* read only.

    So is the IsReadOnly property of the entity not reliable or is it used to indicate something else?

    Friday, January 3, 2014 6:34 PM

All replies

  • Whether you can update a record is determined by the value of the statecode attribute. For most entities the possible values are 0 (Active, can be modified) or 1 (Inactive, cannot be modifed), though certain system entities (e.g. the activity entities) have other possible values

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Friday, January 3, 2014 7:43 PM