Posts

Showing posts from September, 2025

Tip of the week # 217 : Apex Trigger Best Practices

Image
Salesforce : Apex Trigger Best Practices Description : Apex Triggers in Salesforce are a powerful way to extend platform functionality. They enable developers to perform custom actions before or after record changes such as insert, update, or delete operations. To maintain high code quality and performance, it is essential to write efficient and optimized trigger logic. While triggers provide a high degree of flexibility and control, following best practices is crucial to ensure that the code remains scalable, maintainable, and efficient. Apex Trigger Best Practices : One trigger per object We should always write one trigger per object, as having multiple triggers on the same object can cause unexpected behavior due to the lack of a guaranteed execution order. To avoid this, consolidate all trigger logic for an object into a single trigger and delegate the detailed processing to helper classes. This approach improves clarity, maintainability, and control ov...

Tip of the week # 216 : Salesforce Composite and Composite Tree API

Image
Salesforce Composite and Composite Tree API with Examples Description : Executes a series of REST API requests in a single POST request, or retrieves a list of other composite resources with a GET request. Salesforce REST Composite API's : Salesforce REST Composite : To perform multiple REST API calls in a single request.Batch multiple API sub-requests together, execute sequentially (or in parallel), and optionally reference results between them. Method:- Post (For Insert) URL:-/services/data/v64.0/composite Request Body :- { "compositeRequest": [ { "method": "POST", "url": "/services/data/v64.0/sobjects/Account", "referenceId": "newAccount", "body": { "Name": "Test Account" } }, { "method": "POST", "url": ...