1st March 2013
On several occasions I have been asked “How can I lock a record?” There are many reasons why you would want to do this, for example you don’t want Users editing hot Opportunities, or if you want only managers to be able to update a key Account.
There are three main ways to lock a record in Salesforce
2) Record Types
3) Validation Rules
This is the coding option! It is often the first suggestion, but often it is too complex and resource consuming. First make sure you have the skills to write and test it, and also to maintain it.
You can build a checkbox field called ‘Lock’, and create a record type called ‘Lock’, then a Page Layout with all the fields as Read-Only (and take off Edit buttons etc). Then build a workflow to change the record type (and assigned page layout) when the checkbox is ticked.
You could write a validation rule around the checkbox field, above (when the checkbox equals True, show an error message). Or use the ISCHANGED formula, so for example only certain Users can Edit a record.
When locking I would go for Record Types, if you wanted to allow Editing only when certain criteria is met I would go for Validation rules.