Custom Metadata Types vs Custom Settings vs Custom Labels 💬 In plain words: Three lookalikes: Custom Metadata = configuration that DEPLOYS with your code (best for app settings). Custom Settings = org/user-specific values, changeable at runtime (hierarchy type is great for bypass switches). Custom Labels = translatable text for the UI. 📌 Example: API endpoint URLs per environment → Custom Metadata (deploys with code, sandbox vs prod values). A 'Bypass_Automation__c' checkbox an admin flips during data load → hierarchy Custom Setting. The word 'Submit' translated to Hindi → Custom Label. 🎬 Real-Life Example: The Fee Table Trapped Inside Code Skyline charges a different delivery fee per city. Apex needs those rates on every booking. The Old/Bad Way: if (city == 'Delhi') fee = 50. Else if (city == 'Mumbai') fee = 65. … Every rate change is a code change, a test run, and a deployment. Why this is bad: Business data is trappe...
Introduction: Apex test classes play a crucial role in ensuring the quality and stability of your Salesforce applications. They help validate the behavior of your Apex code, uncover potential issues, and ensure proper functionality. In this blog post, we'll explore some best practices to follow when writing Apex test classes in Salesforce. 1. Test Method Annotations: - Use the `@isTest` annotation to mark your test class as a test class. - Utilize the `@testSetup` annotation to create reusable test data that can be used across multiple test methods. 2. Test Data Creation: - Create test data within the test class rather than relying on existing data. - Use the `Test.createStub()` method or `@testVisible` annotations to mock or expose private methods and properties for testing purposes. - Consider using the `Test.loadData()` method to load test data from static resources for more complex scenarios. 3. Test Method Structure: ...