Schedule-triggered Flow versus Batch Apex
Key Takeaway
A schedule-triggered flow is the low-code choice for work that runs at a set time across a batch of records. Batch Apex is the pro-code choice for complex, long-running jobs on large amounts of data, if your team has Apex developers who can maintain it.
A schedule-triggered flow is a low-code automation that runs at a set time and can work through a batch of records that meet filter conditions. Batch Apex is pro-code: a developer writes Apex that splits a large record set into chunks to run complex, long-running jobs on thousands of records. Both tools run in the background, but they differ in the skills required, their scheduling options, and the governor limits they enforce.
How the two tools differ
| Schedule-triggered flow | Batch Apex | |
|---|---|---|
| Skills required | Low-code | Pro-code |
| Scheduling options | A start date and time, plus a frequency of one time, daily, or weekly | A specific time, set with the Apex scheduler in code or from the Schedule Apex page in the user interface |
| Governor limits | Runs in a synchronous context with synchronous limits | Enforces asynchronous limits, and some are higher (for example, SOQL query and heap size limits) |
The higher asynchronous limits are why Batch Apex is best at processing large amounts of data.
Scheduled Apex uses a cron expression to set its time and frequency.