September 9, 2008
Read-only fields on forms are not read-only
Fields in Ms Dynamics CRM cannot be set to read-only!!!
Ok, a little explanation and a demo script to show what I’m implying.
Yesterday a customer asked me to change the text in a read-only field. I’m system administrator on their system, so the easiest way should have been to change the Field Properties of the attribute, but this would allow all users to change this attributes on all records.
Another option would be to use the Enrich Functionality, described in this post.
I tried a third option, triggering javascript via the Address Bar of Internet Explorer. The usage may be well know, but I never thought of using it to modify read-only fields on records. Well, it is surprisingly easy. All you need to know it the id of the attribute you want to modify. (The id can be found with something like the IE Developer Toolbar.)
If you have the id the code is easy and you only have to copy it into the address bar of the record you want to modify:
javascript:crmForm.all.new_attribute.DataValue = "read-only doesn't work for me"; crmForm.all.new_attribute.ForceSubmit = true; crmForm.Save();
This means every user with modify rights on a record can change read-only field on that record.
—



