[SalesForce] “Lock” Old Opportunities so They Can’t Be Edited

For auditing purposes, we'd like to lock Opportunities that have been closed for 90 or more days so that they can't be edited anymore, (except perhaps for a super-user profile, but you don't need to address that in your answer).

I know that I could enforce this with the following process, but I'm curious whether there's a simpler or more elegant way to do this:

  1. Create a custom field called "Date First Closed." This field is updated by workflow the first time the opportunity is closed. (Can't use Close Date b/c users can change that).
  2. Validation rule on Opportunity that blocks saving if Date First Close is 90 days ago or more, unless the user is in one of the allowed profiles.

Notes

  • I'd prefer to avoid using multiple Record Types, because we already have several different Record Types for different sales processes, and it would be cumbersome to maintain Active and Locked versions of each one.
  • Our default sharing mode is Private, so it would be great to do something with Sharing Rules… but I don't see how I could block the Owner from editing, since Owner always has read/write permissions.

Best Answer

I recently wrote a blog post about locking records using approval processes. It is a pretty big hack, but it allows you to lock a record without having to use separate page layouts or record types. Here's how it could work:

  1. Set a time-based workflow rule to update a boolean field called "Lock Record" 90 days after the Opportunity is closed.
  2. Have a trigger that fires when the "Lock Record" field is checked.
  3. The trigger invokes a simple approval process that when finished leaves the record locked.

Admins can unlock the record by clicking the Unlock button at the top of the page, but they can also edit the record without unlocking it.