+ Start a Discussion
Jina ChetiaJina Chetia 

How to make a field read-only using validation rules?

Hi,

I have a field which needs to editable in one scenario and read-only in another. Can I achieve this using validation rules and how? Is there any other configuration where I can set this functionality. The condition depends on the record type, for a particular record type it should be read-only and for another it should be editable.

Thanks,
Jina
NPMNPM

This should be possible either with a validation rule or page layout.  If you have page layouts specific to the record type you see if you can make the field read only on the page layout.  This may likely be the better solution.

IF you choose to try the validation rule route you should be able to use a validation formula like

AND(
RecordTypeId = "your record type ID",  ISCHANGED( your field name )
)

so that when it is true that the record type is the one you want the field to not be editable for AND the value in the field has been changed (edited) the formula evaluates to True and the rule is triggered.

Kent ManningKent Manning
The easiest way to do this is go to Setup \ Administration Setup \ Security Controls \ Field Accessability and select the object (accounts, contact, leads...) this is related to.  You can then view the different fields by

    "Veiw by Fields",
    "Veiw by Profiles",
    "View by Record Types". 

I would choose View by Record Types. Then when the matrix appears, select the field and the profile that you what to change (i.e., field: annual revenue for the contact manager is editable). Click on that item or "cell" and change the field level security to read only.  Go ahead and do the same for the other profiles that you wish to set to read only status.   That should do it and now it will depend on the record type whether the profile has edit or read only rights.

Hope that helps.

Kent