What is the best practice for ensuring that page layouts are read only? It seems like there are three options:

1) Create a seperate page layout and record type where all the fields on that page layout are set to 'read only'. Can automate the record to be set to this read only record type via workflow, Process Builder, code etc.

Benefit: the user on the page (unless a SysAdmin) sees that the fields are not editable.

Downside: multiple page layouts, multiple record types, also have to remember to add a field onto the layout and change its property to 'read only'. Multiple record types will be seen in the UI when running reports.

2) Create a validation rule preventing a record from being edited if a certain criteria is met (for example, if the Stage became 'Closed Won').

Benefit: straight forward and database level (so SysAdmins will hit the error too, as well as any DML update via Data Loader). Keeps concise number of record types and page layouts.

Downside: user could potentially have multiple fields ready to edit if inline editing is enabled, presses 'Save' and hits the validation rule and has therefore wasted time.

3) Visualforce page:

Benefit: can have the benefit of 'read only' but on one record type

Downside: higher technical debt, high maintainability cost, code not clicks

Is there a best practice here or is there an option that I've omitted which would work better?


2 Answers 2


Could not add comment because of lack of points, If I understand you correctly you want to make the fields Read Only on page layouts only.

To do that I would go with 1st approach only -

Create page layouts and make the fields read only on page Layout,
Create a new record type for this page layout. once the record matches certain criteria change the record type using workflow field update. (I am not sure why you mentioned too many record types).

For 2nd approach you might have to consider lot of conditions when to make the record read only, for what users, for what fields..? and yes the user will get annoyed after filling out the values then hitting save button and seeing errors because of validation rules.

For 3rd - you have already mentioned the downside.

  • Fls on the profile will affect all records (object) not just those the op wants as read only
    – Eric
    Commented Sep 14, 2015 at 14:44

I would suggest you to go for option 2 as there is a limitation in option one you cannot make the fields which are required on database level to read only on page layout. e.g. Order Status, Account, etc.

And to avoid the problem where System Admin or using Data loader it throws an error. You can skip the validation to run for System Admin or any other specific profiles.

Your Validation,
NOT( $Profile.Name = 'System Administrator')

But this will not have a good UI where fields actually looks as uneditable.

I generally prefer this approach as it is quick to build and more strong way to prevent editing of a record.

I believe you know now Pros and Cons of all the 3 approaches and you can go for the best one you like.

Thank You.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .