We’ve updated our component, check out the updated instructions here!

One of the great things about Approval Processes is the ability to lock a record so that a user cannot modify that record. One of the hard things to work around is when a locked record needs to be opened up to be edited again, for instance if, during electronic signature, the customer rejects the signature since they want to negotiate.

Enter the Unlock Record Apex Action, available with Process Builder or Flow! It is as simple as adding in your logic, say the a Quote status is updated to Rejected, then unlock the Quote.

Additionally, you can use this in Flow too. Simply select your Apex Action and add the record Id you’d like to unlock.

And voila, your Quote is unlocked! You can leave it as simple as below, or you can add in logic, like ensuring the Opportunity is not Closed Won, or other things like that!

NOTE: If running Unlock Record Apex Action in Flow, it does respect User permissions. So if a User does not have the permission to Edit a Locked Record, then they will not be able to unlock the record by simply clicking a button that launches to a Flow. Use Process Builder as Process Builder runs in system mode. If the logic is too complex for Process Builder, have Process Builder call the Flow to handle the more complex logic and then it can unlock the record. When Flow is called from Process Builder, it runs in system mode as well.


  1. Hi- this is a great tool, thank you! my users that don’t have the rights to unlock a record, are getting an error even if the Flow is run from Process Builder. Is there something I”m missing?

    The error message I get is: “An Apex error occurred: System.DmlException: Delete failed. First exception on row 0 with id XXXXXXXXXXXXXX; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []”

    1. Hi Fred,

      The apex error says Delete failed. This shouldn’t be deleting anything. Are you doing something else in your update? If you launch this from Process Builder, it should unlock no matter what. If you launch it from a button it will not work for someone who does not have the right access, that is until Spring 20, there is an update to allow the flow to run in system mode. I need to test it to confirm, but it should work in that mode for users who don’t have access.


  2. Hi Rich- thanks for your help. You’re right, that is a strange error. It might have nothing to do with this bit of code. I will attempt to isolate the variables in a sandbox and test.

  3. Hi Rich,
    I am trying to use the Unlock function to unlock an opportunity that went through an approval process, but it seems to only do it for admins. I built a flow, set it to run in system mode (which you can do as of spring 2020), and created a url button that users can click to unlock their opportunity. However, it only works for admins. I’ve also tried incorporating the unlock action into an auto-launched flow that is triggered by process builder, but that only unlocks for admins too. Process builder simply ignores the unlocking action and moves on to the next record update for non-admins.

    Please let me know if I am missing anything.


    1. Hi Olya,

      If the record is locked, then out of the box, only those who are allowed to unlock records will be able to use it. It does, however, work with Process Builder in my configurations. So I have had a process unlock a record, for instance if you send out something for signature, you lock the record it sent (like a quote), but then if it is rejected or expired or cancelled, you unlock the record. I have used that with PB. I haven’t tested it in system mode, but will take a look when I get a chance and let you know. I would “think” that should work, but you’ll need to unlock it first before trying to make an update as a user, if that makes sense.


  4. Hi Rich,
    Thank you so much for your quick reply! I have the Process builder triggered by a task creation and the PB is supposed to unlock the opportunity and update the stage as well as several fields on the opportunity, then update the task. The strange thing is that when I create the task, PB does everything perfectly (including unlocking the opp); however, when an end user creates a task the PB does everything EXCEPT the opportunity remains locked. So PB is able to update a locked opportunity when triggered by an end user (an end user without the modify all permission) but it’s not able to unlock the said opportunity. I hope that explanation makes sense!

    Thank you again!


  5. Hi Rich
    This used to work for non admins for me. Currently when a non admin who has modify all rights on the KB object click the unlock button that triggers the flow to unlock the KB the non admin is now getting the same error below

    : “An Apex error occurred: System.DmlException: Delete failed. First exception on row 0 with id XXXXXXXXXXXXXX; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []”

    1. Hi Jonathan,

      The component follows user security, so if they don’t have rights to edit a locked record (modify all), then they wouldn’t be able to use the unlock. We did come out with a new release of Flow Components and in the updated version we do have a capability now for you to allow users who don’t normally have the rights to unlock a record to be able to unlock the record. Please see the following article and let me know if that helps. https://englhardconsulting.com/flow-components-unlock-record/


  6. Its great to be able to lock and unlock in flow with this but is there also a way to test records before they enter the flow to see if locked or unlocked?

    1. Hi Dave,

      There is a lightning component, locked record notifier, that you can add to a lightning page that will show a user a notification if the record is locked. There isn’t anything in Flow components that will read that in the Flow itself though.


  7. Hi Rich,
    I need some help with Unlick record.
    After downloading the package, I added a flow and process builder calling the flow. Added permissions sets to user and profile. Nothing worked.


  8. Hi Rich,

    I have a record trigger flow that is trying to lock the opportunity product records when the opportunity stage is closed won. I get an apex error.

    Error Occurred:
    An Apex error occurred: System.UnexpectedException: Entity id: XXXXXXXXXXXXXXX cannot be locked.

    Is there a restriction on the opportunity product object?


  9. Hi Rich,

    I have a strange one. We are trying to unlock a Quote when it reaches a certain stage. I have a simple flow which checks that stage as an entry condition. I store the Id into a variable and then pass it to your component.

    When I test it, it works but not all the time. I just tested there times and the first two the record was unlocked and the final one it was not unlocked. I used the same steps and users.

    Can you suggest where I should look?

    Much thanks!

Leave a Reply

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