Skip to content

Flow vs Apex Decision Matrix & Build vs Buy Scenarios

Decision matrices for the two most common D4 decisions: (1) when to use Flow vs Apex, and (2) when to build custom vs buy from AppExchange. Print this and keep it nearby during mock boards.

Flow vs Apex Decision Matrix

Find your scenario on the left, read across for the recommendation.

ScenarioRecommendationRationale
Simple field update on triggering recordBefore-Save FlowZero DML cost, admin-maintainable
Field update on related recordsAfter-Save FlowDeclarative, handles moderate volume
Complex calculation with conditional logicApex + InvocableCleaner in code, testable, callable from Flow
Processing > 50K recordsBatch ApexFlow struggles past 50K; Batch handles millions
Multi-object transaction with rollbackApex TriggerExplicit savepoint/rollback control
Simple REST callout with OpenAPI specExternal Services + FlowNo code needed, admin-maintainable
Complex callout with retry/circuit breakerApex CalloutFull control over error handling
Guided wizard with standard inputsScreen FlowFast to build, admin-maintainable
Complex UI beyond standard componentsScreen Flow + Custom LWCLWC handles the custom part, Flow orchestrates
Scheduled batch cleanupScheduled Flow (simple) / Schedulable + Batch (complex)Volume and complexity determine which
Event-driven async processingPlatform Event + Flow or ApexDecoupled, separate transaction
Lead assignment with geo-rulesFlow + Invocable ApexAdmins manage routing; Apex handles geo-calc
Real-time lead scoringBefore-Save FlowSimple field calculation, no DML
Nightly ERP data syncBatch Apex + SchedulableVolume, error handling, retry logic

Decision Flowchart - Condensed

Decision tree routing a new automation requirement to Before-Save Flow, After-Save Flow, Batch Apex, Apex Trigger, External Services, Apex Callout, or Screen Flow based on scope and volume.
Figure 1. The first branch (“does this only modify the triggering record?”) is the highest-value question: a yes routes to Before-Save Flow with zero DML cost. Volume above 50K and multi-object transactions with rollback requirements are the two triggers that move a requirement from Flow to Apex.

Trade-Off Comparison Table

FactorFlowApexBoard Talking Point
Dev speedFaster (simple logic)Faster (complex logic)“I chose Flow for speed since the logic is straightforward”
MaintenanceAdmin-friendlyDeveloper-required”The customer’s team is admin-heavy, so Flow reduces ongoing cost”
TestingManual, limitedAutomated, CI/CD-ready”Apex gives us automated regression testing in the pipeline”
PerformanceGood (simple ops)Better (complex ops)“Performance is critical here; Apex is compiled and optimized”
DebuggingFlow Debug UILogs, stack traces, IDE”Debugging complex orchestration requires Apex’s tooling”
Error handlingFault paths (basic)Try-catch (full control)“Integration error handling requires Apex’s retry patterns”
Bulk opsCareful design neededNatural with collections”Data loader operations demand Apex’s native bulkification”
Version controlMetadata exportNative source tracking”CI/CD pipeline requires source-trackable Apex”

Order of Execution - CTA Must-Know

Left-to-right sequence of automation layers during a record save, from System Validation through Before-Save Flow, Triggers, After-Save Flow, Commit, and async After-Save Flow.
Figure 2. Before-Save Flows run before triggers and before the record is committed, making them zero-DML for same-record field updates. After-Save Flows that update the triggering record re-enter the entire order of execution, creating a recursion risk that Before-Save Flows avoid entirely.

Recursion Trap

After-save flows that update the triggering record re-enter the entire order of execution. Before-save flows do NOT cause re-entry. Apex triggers use static variables to prevent infinite loops. Know this - the board will ask.

Build vs Buy - Quick Decision Table

Capability TypeDefault RecommendationReasoning
CPQ / Complex pricingBuy (Revenue Cloud, Conga)Commoditized, extremely complex to build
E-SignatureBuy (DocuSign, Adobe Sign)Legal compliance, audit trail - never build this
Document generationBuy (Conga, Nintex)Not competitive advantage, proven at scale
Telephony / CTIBuy (Five9, Amazon Connect)Infrastructure-heavy, PCI concerns
Data quality / dedupBuy (DemandTools, RingLead)Ongoing maintenance burden too high to build
Advanced analyticsBuy (CRM Analytics, Tableau)ML/AI capabilities hard to replicate
Payment processingBuy - ALWAYSPCI-DSS compliance makes build impossible
Core business processBuild customCompetitive advantage, unique requirements
Simple notificationsPlatform nativeFlow email alerts, platform events
Basic reportingPlatform nativeStandard reports and dashboards

TCO Comparison - The 3-Year Rule

YearCustom BuildAppExchange Buy
Year 1HIGH (dev + test + deploy)MEDIUM (license + implement + integrate)
Year 2LOW-MEDIUM (maintenance)ONGOING (license + config + upgrade testing)
Year 3MEDIUM (feature dev + tech debt)ONGOING (license + customization gaps growing)
Year 4-5HIGH (debt compounds, dev turnover)ONGOING (license, may increase)

The TCO Formula

Build: Initial Dev + (Annual Maintenance x Years) + Enhancement Cost + 20-40% Risk Premium

Buy: (License Cost x Users x Years) + Implementation + Integration + Upgrade Testing

The risk premium for build accounts for scope creep, developer turnover, and unforeseen complexity. Always include it.

AppExchange Evaluation - The Disqualifiers

Instant disqualifiers:

DisqualifierWhy
Failed or no Salesforce security reviewNon-negotiable for enterprise use
No recent updates (12+ months inactive)Vendor may be abandoning product
Does not meet functional requirementsCannot fill the gap even with customization
Unacceptable governor limit impactBreaks your transaction budget
Unacceptable data model impactPollutes your schema, blocks future design

Reverse-Engineered Use Cases

Scenario 1: Healthcare - Patient Intake

Situation: Hospital network needs multi-step patient intake form with insurance verification callout, document upload, and HIPAA-compliant data handling.

Decision: Screen Flow + Custom LWC (for document upload component) + Apex Invocable (for insurance verification callout with retry logic). NOT OmniStudio - the client does not have Industry Cloud licensing, and the ROI does not justify the additional license cost for this single use case.

Board defense: “I chose Screen Flow as the orchestration layer because the admin team can maintain the form steps. The insurance verification requires Apex because it needs retry logic and structured error handling that External Services cannot provide. The custom LWC handles the document upload with preview, which exceeds standard Screen Flow components.”

Scenario 2: Manufacturing - ERP Price Sync

Situation: Manufacturer needs real-time price lookups from SAP during quoting. 10K quotes/month, prices change daily.

Decision: Buy Salesforce Revenue Cloud for the quoting engine + Apex integration for SAP price callout (not External Services - needs caching, fallback pricing, and retry). Platform Event for async price cache refresh overnight.

Board defense: “Revenue Cloud is commoditized - building a custom quoting engine would take 6 months and cost 3x the 5-year license TCO. For the price integration, I chose Apex over External Services because we need a local price cache with fallback logic when SAP is unavailable.”

Scenario 3: Non-Profit - Donation Processing

Situation: Non-profit with 3 admins, no developers. Needs donation tracking, receipt generation, and basic reporting.

Decision: Platform native (custom objects, validation rules, before-save Flows) + AppExchange for receipt generation (Conga or similar). Do NOT build Apex - the team cannot maintain it. The entire solution must be admin-maintainable.

Board defense: “The declarative-first principle is not just a best practice here - it is an operational necessity. With zero developer capacity post-go-live, every piece of automation must be Flow-based. I chose an AppExchange package for receipts because building PDF generation in Apex would create an unmaintainable dependency.”

LWC vs Aura vs Visualforce - One-Line Answer

SituationAnswer
New componentLWC: always
Existing Aura, working fineKeep Aura, new features in LWC
Existing Aura, unstableRewrite in LWC
Existing VF, business value in migrationPhased migration to LWC
Existing VF, low usage, working fineKeep VF, add to tech debt backlog

Board Sound Bite

“Never migrate for migration’s sake. The board values pragmatic architecture. Migrating a stable Visualforce page used by 5 people monthly is a poor use of resources.”

Sources

Personal study notes for the Salesforce CTA exam. Content compiled from VJ's study notes, official Salesforce documentation, community sources, and online publicly available content, then organized and presented with AI assistance. Not affiliated with Salesforce. © 2025–2026 VJ Srivastava.