Salesforce offers two major ways to stream events across systems — Platform Events (PE) and Change Data Capture (CDC).Both use the Salesforce Event Bus with replay support, but they exist for different reasons. In short: Platform Events are custom, intentional messages you define to represent business actions or commands. Change...
Actionable design patterns, step-by-step automation (Flow, Apex, LWC), and opinionated best practices
In event-driven Salesforce architectures, messages often outlive the code that processes them. That’s why it’s critical to evolve schemas safely, trace events end-to-end, and handle duplicates without causing side effects. This guide walks you through practical approaches for versioned Platform Events, correlation/causation IDs, and idempotent consumers with deduplication, including compact...
In Salesforce event-driven systems, Platform Events are delivered at least once — meaning the same message can show up multiple times or even arrive out of order. That’s completely fine, as long as your consumers are idempotent (safe to process more than once) and you have a durable replay strategy...
When your Salesforce org contains millions of records, how you read and process that data matters just as much as what you do with it. Salesforce’s Batch Apex is designed to process massive datasets within governor limits—but to use it effectively, you need well-tuned scope sizes, efficient “queryMore”-style pagination, and...
Asynchronous Apex can massively scale your Salesforce org—but only if you chain jobs safely, manage state effectively, handle errors gracefully, and maintain visibility into what’s happening behind the scenes. This guide walks through real-world strategies for chaining async jobs, passing state across transactions, handling errors reliably, and monitoring everything in...
Salesforce provides four main asynchronous processing tools — @future, Queueable, Batch, and Schedulable — each designed for different use cases. Choosing the right one impacts performance, reliability, governor limit management, and the overall user experience. In this guide, we’ll break down their strengths, ideal use cases, and limitations. You’ll also...
In Salesforce, almost everything — DML, SOQL, triggers, and flows — runs inside a single transaction. That’s powerful because it ensures data consistency: if something fails and isn’t handled, the entire transaction rolls back automatically. But in the real world, not everything needs to be all-or-nothing. Sometimes you want partial...
Designing a great Apex trigger starts with three fundamentals: Choosing the right trigger timing (before vs. after) Managing cross-object updates cleanly Offloading heavy or error-prone work to asynchronous processes Get these right, and your automations will stay fast, bulk-safe, and reliable — even under complex business logic. ? Trigger Timing:...
In Salesforce, your Apex code must handle anywhere from 1 to 200 records per transaction — all while coexisting with flows, triggers, and other automation. Two foundational principles make this possible: Bulkification — designing logic that efficiently processes lists of records without hitting governor limits. Mixed DML and lock awareness...
In Salesforce Apex, triggers are incredibly powerful — but without structure, they can spiral into chaos fast.To keep your automation clean, scalable, and predictable, follow three cornerstone practices: One trigger per object A trigger handler pattern Recursion guards Together, these principles make your code easier to debug, safer to scale,...
