Skip to main content

Posts

Showing posts with the label locking and unclocking record in salesforce.

How to Lock/Unlock record thorough Apex code ?

Hi All, We all have faced many business scenario where we have to lock/unlock records. We had traditional approach to create separate record type and page layout to achieve it, but salesforce has given API to do thorough apex code. Please make sure below settings is enabled. Locking Record  1. Create a standard Approval process which will take care of locking records. http://salesforceworld4u.blogspot.com/2017/07/how-to-supress-standard-approval-email.html 2. Invoke Approval process   a. Using Process builder (Submit for Approval)   b. Use Apex code to invok from trigger or custom button.  /*     * This method will invoke the standard approval process     */     public static void submitForApproval(Case caseRecord)     {         // Create an approval...