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...
Sometimes, there arises a need to delete records from an object in Salesforce. To address this requirement efficiently, we can utilize a batch class that handles the deletion process. This solution leverages the power of custom metadata types to pass the object information, offering flexibility and easy maintenance. By modifying the custom metadata records, instead of modifying the batch class itself, you can effortlessly manage the deletion process. In this blog post, we will explore an approach that enables you to delete records in a more dynamic and scalable manner, reducing manual effort and providing a robust solution for record deletion. Batch Class:- Global class DeleteRecords Implements Database.batchable<sobject>,database.stateful { global string query; global integer totalSizeRecords=0; global Database.QueryLocator start(Database.BatchableContext BC){ Delet...