Auto-Lock Records with Process Builder
I eventually get this request at every company I’ve worked with. I want to be able to “lock” a record after some sort of criteria. Sometimes it’s really easy and you’re able to simply create a validation rule that says if the record matches x criteria throw an error. Sometimes, it can be more complicated than that. My favorite reason is they want to prevent the user from editing the record at all, not just throw an error when they try to save the change.
Their argument is valid, their point is it’s more user friendly and a better user experience to prevent the user from using the edit button than allow the user to enter the edit screen, make a bunch of changes, and then get frustrated by receiving an error.
This method can be really useful for records that have a high compliance need. Records that absolutely you don’t want people to edit after the records meets your criteria.
There are only two items we need:
- Approval Process to lock the record
- Process to Submit Record to the Approval Process
The Approval process is very simple. We’re going to use a formula as the Approval criteria. The formula is simply going to be “false.” This way a user cannot accidentally submit a record into this approval. It will only be submitted using the process we created.
We’ll also only have a single Approval Step. We’ll have all records enter this step and if it doesn’t meet the criteria we’ll approve the record. Again, we’ll use a formula for the step criteria and make it false. This way every record that gets submitted will fail to meet the step criteria and just get approved.
The Process is also going to be really simple. Whatever your criteria is for when you want to lock the record you should set as the criteria node. That’s the blue diamond – think of it like a Workflow rule.
Next, we’ll need to add an action. We’ll add the action “Submit for Approval.” We’ll select a specific approval process, the one we just created. Here’s the important part, you’ll want to check the box to skip the entry criteria. Remember, the entry criteria would not accept any record. By skipping the criteria for the Approval process the record will get run through the approval steps.
That’s it! We’re done! Isn’t that simple? Now you can lock the record from editing whenever a record meets a set of criteria without having to write any validation rules.
Anyone who as “Modify All” on the object will be able to “unlock” the record to edit it. You may want to enable track history so to capture who unlocked a record.
You can also put a “delay” in the record locking. Instead of making it a “immediate” action, you can schedule the action based on some date on your record.