I am trying to find a solution how to make a case record read only if the Case status is equal to closed. Can it be done?


One solution would be to update the RecordType of the Case when it's Status field is updated to "Closed". You could do this using a Workflow.

This record type could then use a Page Layout that has it's fields set to "Read Only" at said Page Layout level.

Alternatively, you could use a Trigger to use Approval Process style locking to restrict the record based on the Status field. This was introduced with Winter '16.

| improve this answer | |

You can take this approach:

  1. Create a page layout and make all fields readonly on this page layout. Create a recordtype and assign this recordtype and page layouts during Case closure by workflow field update or from Process Builder. This is from UI level restriction.

  2. To restrict data being updated from API or data migrations etc. create a trigger and verify the Case status from Trigger.old and throw an exception if record is being modified.

| improve this answer | |
  • 2
    Why does 2 have to be a trigger? You can just use PRIORVALUE. – Adrian Larson Sep 12 '16 at 13:25

You could also create a validation rule that would stop your users and the API user from editing the record.

Something like

ISPICKVAL(Status, "closed")

It's a little quicker than the record type/page layout method. However, validations are cruel in that it will stop any user that does not meet the criteria. So if you have a need that something still needs to edit the record like a API user then the layout will work. If you want to lock it down to anyone try the validation.

| improve this answer | |
  • That will prevent you from closing it in the first place, though. You need to use PRIORVALUE. – Adrian Larson Sep 12 '16 at 19:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.