Posted on 2. July 2012

The object cannot be updated because it is read-only

When re-activating a case in Dynamics CRM 2011 via the Form Ribbon button, you may recieve the message:

The object cannot be updated because it is read-only

The usual cause of this issue is a piece of javascript in the form onload event changing the value of a field or setting the submit mode to 'always'.

I recently discovered another reason why this can happen:

If you have a N:1 lookup field on a form, and the related record's name attribute has a trailing space in the name field (e.g. 'A record ') , the lookup attribute will always be dirty on the referencing form, irrespective of if it has changed or not. 

So when you try and re-activate a case, the form will be submitted with the lookup field appearing as though it has been edited, and you will receive the message from the server indicating that the record cannot be updated.

To resolve this issue, simply remove the trailing space!

Normally, field values will have trailing spaces stripped off when saved via a form, but this issue can be caused by data being imported with trailing spaces in the field values.

Hope this helps!

 

Comments are closed