7 Checkpoints for Salesforce Developer
Apr24

7 Checkpoints for Salesforce Developer

As a Salesforce developer you are supposed to take some mandatory precautionary measures for development, testing and deployment. Development in itself could be a complex job. We should be careful enough while we are designing the UI or implementing any business logic. This piece of advice can be a long list of Do’s & Dont’s but I will be summarizing the top 7 domains under which a novice or a seasoned developer can make mistakes. Trigger: Less Code in Trigger: Business logic should be written in Apex classes and purpose of writing a trigger should be to divert the various update, insert, delete, before, after control flows to the correct Apex class. Context-Specific Handler Methods should be their in Apex classes. Bulkification. While developing a fresh trigger we should always think of the possibility that the records in the object can be inserted, updated, deleted by a User in bulk using API, Data Loader tool or custom Multiple edit page etc. NULL Check: This is a very basic check which every developer learns in the course of testing triggers which they developed. One Trigger for One Object: Creating multiple triggers on the same object will cause warnings in Checkmarx code review for Appexchange. Self looping triggers: Beware of this and make sure you use a Static field in class to verify the trigger is not getting called multiple times. Webservice callouts from Triggers: Can’t hit more than 10 callouts at a time. Design Patterns are good solution for this. Trigger Frameworks and Apex Trigger Best Practices Visual Force: SOQL: Make sure the query is having a limit or an intelligent WHERE clause. A query can be written in Salesforce in multiple ways. Design: If the Logic permits then use components and divide the screen in separate pages or Wizard steps. Use Static Resource for all the CSS and images. Separate JQuery, Javascript files will also be good. Check View-state: Make sure that the Salesforce view state size is always in check. Action Tags: The lesser number of action tags the less will be callouts to Salesforce controller(Server). Most of the simple business logic/validations can obviously be carried to client side scripting. Best Practices for Improving Visualforce Performance Web Service: Commit Rollback exception. This should be taken care of SOAP: We should have the clear understanding of WSDL we are going to use in Salesforce. Web Service, parameters, range and return value. SOAPUI is one of the best desktop based tool to do a dummy test. WSDL FILE size limit may some time demand trimming: Will need WSDL expertise for this job. REST: The services resources should be identifiable and...

Read More