Lock Record

Salesforce Approvals are a great feature that allow you to be able to track approvals and lock records from having any changes after approvals. Sometimes, however, an Approval Process doesn’t fit into the situation that you’re trying to create. You know how to create a custom approval process to achieve the process part of it, but since you’re not using the standard Salesforce Approval Process, you can’t lock the record.

With the Lock Record Apex Action, you can now lock that record.

Use the Lock Record Apex Action with Process Builder to automatically lock a record based on something like, the status going to Approved.

Additionally, you can use Flow and the Apex Actions in Flow to lock a record.

A simple Flow will allow you to lock a record, or add your custom logic to lock the record only after it has gone through a custom approval.

NOTE: Unlike the Unlock Record Apex Action, any user who has edit rights on a record will be able to lock the record. This means that you can lock a record from a Flow button without having to use Process Builder.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

4 responses to “Lock Record”
  1. Ben Patterson Avatar

    Great thing here. Correct me if I’m wrong, but this won’t work in flow builder debug. That might save someone the time I lost. 🙂

    1. Rich Englhard Avatar

      Hi Ben,

      It should still work in flow builder in debug. You need to ensure that the debug has a way to get the record id that you’re trying to lock or unlock, but as long as you send the Apex Action for lock record (or unlock, if you’re using that), then it should work in debug mode. It does run with user rights, so ensure you have read/write rights on the record.

      Rich

  2. Smith Avatar
    Smith

    I’m very new to this so I may be doing something wrong. How do you trigger a lock record using a button on the opps page? Every time I try to do it using a screen flow I get an error lockId = {recordId} (null)

    I’ve done the same with an unlock record flow and that one worked fine, and a process on an action triggered flow that works fine for locking.

    1. Rich Englhard Avatar

      Hi Smith,

      It seems that you’re sending in a null record id to the lockid. You’ll need to send in a valid Id to the action.

Discover more from Englhard Consulting LLC

Subscribe now to keep reading and get access to the full archive.

Continue reading