Skip to main content

Custom Metadata Types

Explore practical guides and implementation patterns for this topic.

Posts

Topic Batch Apex Best Practices Bulk Deletion Custom Metadata Types Data Archival Dynamic SOQL Salesforce Development
Batch Apex Best Practices Bulk Deletion Custom Metadata Types Data Archival Dynamic SOQL Salesforce Development

Metadata-Driven Record Deletion in Salesforce: Scalable Batch Apex Guide

In plain words: A Metadata-Driven Deletion Batch is a reusable Batch Apex job that purges outdated records based on configuration rules stored in Custom Metadata Types (CMDT) . Instead of editing and deploying code whenever you need to clean up an object, administrators simply update metadata fields (such as target object name, date range, or active status), and the batch automatically executes the correct SOQL query. Maintaining data hygiene and keeping storage consumption within platform limits often requires automated record cleanup. However, hardcoding object names, date filters, or WHERE clauses directly inside Apex classes creates ongoing maintenance debt. Every requirement change forces developers to edit code, write new unit tests, and coordinate production deployments. Coupling Batch Apex with Custom Metadata Types creates a declarative engine that lets teams manage data retention policies without touching code.
Read article
Salesforce Architecture & DevOps

Custom Metadata vs Custom Settings in Salesforce: Complete Architecture Guide

💬 In plain words: The golden rule for Salesforce configuration is simple: Metadata DEPLOYS, Settings CHANGE, and Labels TRANSLATE. Custom Metadata Types carry their records automatically through deployments (perfect for app config). Custom Settings store org or user-specific data that you can toggle instantly at runtime (perfect for bypass switches). Custom Labels store text that needs to be translated for the user interface. Hardcoding values like API endpoints, delivery fees, or trigger bypasses directly into Apex is a massive architectural anti-pattern. When business rules change, hardcoded values force you to rewrite code, run tests, and wait for a release window. To keep configuration out of your code, Salesforce provides three primary tools: Custom Metadata Types (CMDT) , Custom Settings , and Custom Labels . Knowing exactly when to use each prevents deployment headaches and governor limit crashes.
Read article