Best Practices

Best Practices with Salesforce Apex in 2022

#1MinuteTip Time to review / update your Apex best practices in Salesforce. Here is exactly what you need. In TrailblazerDX 2022 (#TDX22), Mohit Shrivastava & Kevin Poorman from Salesforce did a presentation on the same and have very kindly shared the presentation with everyone.

Salesforce Developer Best Practices Checklist

#1MinuteTip How do you ensure that you have followed all the best practices when writing code in Salesforce? Like you only have one trigger on an object and that you are using trigger handler rather than writing logic in trigger itself. You are not using SOQLs or DMLs inside the loop. There is a simple solution – use a checklist before and after you are done with your coding.

Here is the link to all the best practices that you need to follow when writing code in Salesforce – Drive Consistency and Grow Developer Skills with a Developer Best Practices Checklist

I am a big fan of checklists. First introduced decades ago by the U.S. Air Force, checklists have enabled pilots to fly aircraft of mind-boggling sophistication. Checklists are being adopted in hospitals around the world, helping doctors and nurses respond to everything from flu epidemics to avalanches. To read more about how helpful checklists can be, please check out this one of the best selling books “The Checklist Manifesto: How to Get Things Right” by Atul Gawande

Salesforce Developer Best Practices Checklist

Recommended Framework for Salesforce Triggers

#1MinuteTip A good framework gives you a structure based on best practices that you can reuse. It is optimized, increases the speed of development & improves the efficiency of your code. Implementing a good framework becomes more important when you are working on a multi-tenant platform like Salesforce where there are limits on the amount of resources you can use. 

Salesforce recommends one such framework to implement your triggers. As mentioned in the Trailhead Module Success Cloud Coding Conventions -> Implement Framework, it says “Having said that, Kevin O’Hara’s SFDC Trigger Framework is the one we generally prefer on large-scale projects within the Success Cloud team at Salesforce.

Check it out at URL

Recommended Framework for Salesforce Triggers based on best practices

Check the Quality of Your Code in Salesforce

#1MinuteTip How secure and performant is your code in Salesforce? Is it following the best practices? Can it be improved further? Are there any vulnerabilities? Don’t forget to pass it through the Code Scanner before deploying any new code. It’s free.

Quality of Code in Salesforce

Or please refer to the page Useful Resources: Source Code Analysis Tools for a list of different static source code analysis tools for Salesforce

Scroll to Top