# Choosing Flow, Apex or both for automation

*Platform Developer II Study Guide · Process Automation, Logic, and Integration · Last updated October 16, 2026 · https://www.certifyforce.com/study-guide/platform-developer-ii/process-automation-logic-and-integration/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.

- Certification: Salesforce Platform Developer II
- Exam section: Process Automation, Logic, and Integration
- Study guide: https://www.certifyforce.com/study-guide/platform-developer-ii

**Official exam objective:**

> Given a scenario, propose and justify the optimal programmatic or declarative solution.

## 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

| Fact | Detail | Source |
|---|---|---|
| Low density | Under 15 automations, 1-200 records, 0-1 downstream DML: record-triggered flow | [Decision Guide](https://architect.salesforce.com/docs/architect/decision-guides/guide/record-triggered) |
| High density | Over 30 automations, 2,000-10,000+ record loads, 5+ downstream DML: Apex trigger framework | [Decision Guide](https://architect.salesforce.com/docs/architect/decision-guides/guide/record-triggered) |
| Entry points | One mechanism per object; avoid mixing flows and triggers | [Decision Guide](https://architect.salesforce.com/docs/architect/decision-guides/guide/record-triggered) |
| Before-save flow elements | Assignment, Decision, Get Records and Loop only | [Before-Save Flows](https://help.salesforce.com/s/articleView?id=platform.flow_concepts_trigger_record.htm&type=5) |
| Invocable actions in flows | After-save only; no before-save support | [Decision Guide](https://architect.salesforce.com/docs/architect/decision-guides/guide/record-triggered) |
| After undelete | Not supported by record-triggered flows; needs an Apex trigger | [Decision Guide](https://architect.salesforce.com/docs/architect/decision-guides/guide/record-triggered) |
| Invocable inputs and outputs | At most one input, a list; outputs match inputs in size and order | [InvocableMethod Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm) |
| Invocable visibility | Only global invocable methods appear in a subscriber org's Flow Builder | [InvocableMethod Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm) |
| CPU time limit | 10,000 ms per synchronous transaction; 60,000 ms asynchronous and for Bulk API | [Governor Limits](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm) |
| Future method timing | Runs when system resources become available | [Future Methods](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_invoking_future_methods.htm) |

## Check yourself

- 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?

## Sources

- [Record-Triggered Automation Decision Guide](https://architect.salesforce.com/docs/architect/decision-guides/guide/record-triggered)
- [Before-Save Record-Triggered Flows](https://help.salesforce.com/s/articleView?id=platform.flow_concepts_trigger_record.htm&type=5)
- [InvocableMethod Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm)
- [Transaction Control](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_transaction_control.htm)
- [Execution Governors and Limits](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm)
- [Future Methods](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_invoking_future_methods.htm)
- [Improve Business Processes with Salesforce Automation](https://trailhead.salesforce.com/content/learn/modules/flow-basics/go-with-the-flow-th)
- [Triggers](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers.htm)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 8 linked practice questions, and unlimited timed mock exams are included with the Platform Developer II pack (USD $19): https://www.certifyforce.com/practice-exams
