Choosing Flow, Apex or both for automation
How automation density, one entry point per object and the before-save versus after-save split decide between a record-triggered flow, an Apex trigger and the hybrid of a flow calling bulk-safe invocable Apex, plus the requirements only Apex or only Flow meets.
Given a scenario, propose and justify the optimal programmatic or declarative solution.
~8 min read · 8 practice questions ·
What the exam expects
- Pick a record-triggered flow, an Apex trigger framework or the Flow + invocable Apex hybrid from an object's automation density and who maintains it.
- Keep one automation entry point per object, and place a new requirement inside the mechanism the object already uses.
- Split same-record field updates (before save) from related records, email and Apex actions (after save).
- Recognise requirements only Apex meets (after undelete, savepoints and partial rollback, maps, sets and static caching) and ones Flow meets best (scheduled paths, email alerts).
- Write a bulk-safe invocable method: list in, list out, same size and order.
Key terms: automation density (automation count, records per transaction and downstream DML on one object); entry point (the flow or trigger through which an object's automation starts); hybrid pattern (a record-triggered flow orchestrates and calls invocable Apex for hard steps); scheduled path (a flow path that runs relative to a record date); invocable method (an Apex method annotated @InvocableMethod that flows call as an action).
Key facts
- Detail
- Under 15 automations, 1-200 records, 0-1 downstream DML: record-triggered flow
- Detail
- Over 30 automations, 2,000-10,000+ record loads, 5+ downstream DML: Apex trigger framework
- Detail
- One mechanism per object; avoid mixing flows and triggers
- Detail
- Assignment, Decision, Get Records and Loop only
- Detail
- After-save only; no before-save support
- Detail
- Not supported by record-triggered flows; needs an Apex trigger
- Detail
- At most one input, a list; outputs match inputs in size and order
- Detail
- Only global invocable methods appear in a subscriber org's Flow Builder
- Detail
- 10,000 ms per synchronous transaction; 60,000 ms asynchronous and for Bulk API
- Detail
- Runs when system resources become available
Sources for this section (5)
- Decision Guidearchitect.salesforce.com (opens in a new tab)
- Before-Save Flowshelp.salesforce.com (opens in a new tab)
- InvocableMethod Annotationdeveloper.salesforce.com (opens in a new tab)
- Governor Limitsdeveloper.salesforce.com (opens in a new tab)
- Future Methodsdeveloper.salesforce.com (opens in a new tab)
- Why does a new same-record default on a 30-automation, Apex-framework object go into the framework rather than a before-save flow?
- When must a team that standardised on Flow bring in Apex?
- Which flow can call an invocable Apex method on a record-triggered save?
- Why must an invocable method return its results in the same order as its input list?
The questions are free to read. Answers with their sources and self-grading are included with the pack.
Keep reading with the Platform Developer II pack
- Core concepts
- Exam traps
- Worked scenario
The pack includes:
- All 28 lessons of the Platform Developer II guide, with reading progress
- Interactive decision walks and step-by-step sequence steppers
- Inline practice questions and one-click topic practice (8 questions for this lesson)
- An official source cited for every claim
- An AI tutor that answers from the guide
- Unlimited timed practice exams