“How to lock records in Salesforce” is still a very popular question in the Salesforce ecosystem. And there are various different ways (Approval processes, record types etc.) people have proposed to resolve it.
Wonder how easy it would be if you could just do it with Flows?
Some if you might be already familiar with an action existing on unofficialsf.com; last I checked there was only one action that can be used to unlock a record.
So, I created a utility (an unlocked package) that you can install in your orgs and use it in the flows to lock/unlock records. The package comes with 2 actions; Lock Record and Unlock Record.
Installation
You can install the package from the repo.
Post Installation Step
Go to Setup –> Process Automation Settings –> Enable “Enable record locking and unlocking in Apex” checkbox.
NOTE: If the user has “Modify All” permission, it can still modify the locked record.
Hope you find this one useful! Catch you in the next one! ✌
And thank you for being an awesome reader! Subscribe to this blog for receiving all the latest updates straight to your inbox.
How do we use it? Do you have any example using a flow?
LikeLike
Brilliant!
And very flexible, very useful. Thank you!
LikeLiked by 1 person
Hello, there is an error installing the package:
“This package can’t be installed.
There are problems that prevent this package from being installed.
Package Not Found The requested package doesn’t yet exist or has been deleted. If this is a recently created package version, please try again in a few minutes or contact the package publisher.”
LikeLike
Updated the correct package Id. Can you try again?
LikeLike
Hi, Just wanted to add, as it took me a while to find the answer, If the users have the “modify all” permission then they ignores the lock, remove this permission and everything is good. Other than that this is great addition!
LikeLike
Hey Anthony,
Thanks for this info! I’ll add it to the post
LikeLike