Skip to main content

SF-0396 · Concept · Medium

Is there any mandatory method(s) that must be implemented?

✓ Verified by Vikas Singhal · Last reviewed 5/17/2026 · Updated for Spring '26

Yes — exactly one mandatory method:

public void execute(SchedulableContext ctx);

That’s the entire Schedulable interface. If you implement Schedulable without providing this method (or with the wrong signature), the class won’t compile.

The exact signature

ElementRequirement
Visibilitypublic (or global for managed packages)
Return typevoid
Method nameexecute
ParameterExactly one: SchedulableContext ctx
Static?No — instance method

Any deviation and the compiler rejects the class as not implementing Schedulable.

Why only one method?

Schedulable is intentionally minimal. The schedule itself (cron expression, name, frequency) is configured outside the class via System.schedule. The class only needs to know what to do when fired — that’s execute.

What you’d write

public class WeeklyReportSender implements Schedulable {
    public void execute(SchedulableContext ctx) {
        // ... your scheduled logic
    }
}

Then somewhere (anonymous Apex, setup script, deployment hook):

System.schedule(
    'Weekly Sales Report',
    '0 0 8 ? * MON',          // Monday 8 AM
    new WeeklyReportSender()
);

Inside execute — what’s typical

Most production execute methods do one of three things:

1. Kick off a Batch job

public void execute(SchedulableContext ctx) {
    Database.executeBatch(new MyBatch(), 200);
}

2. Enqueue a Queueable

public void execute(SchedulableContext ctx) {
    System.enqueueJob(new MyQueueable());
}

3. Do the work directly (small jobs)

public void execute(SchedulableContext ctx) {
    List<Lead> leads = [SELECT Id FROM Lead WHERE Score__c > 80 LIMIT 100];
    // ... process inline
}

For anything heavy, use option 1 or 2 — Scheduled Apex execute has the standard governor limits and isn’t optimized for huge workloads.

What execute is not allowed to do directly

  • No HTTP callouts. Scheduled Apex doesn’t support direct callouts. Use Queueable (Database.AllowsCallouts) called from execute.
  • No future calls — well, actually you can. @future from Scheduled is allowed (Scheduled is treated as sync for this rule). But best practice is to use Queueable.

Common interview follow-ups

  • Can I have multiple execute methods? — In the same class, yes, if they have different parameter types (execute(SchedulableContext) plus execute(Database.BatchableContext, scope) for a combined Schedulable+Batchable class).
  • Can execute throw an exception? — Yes — it surfaces in the CronTrigger as a failure and is emailed to apex exception recipients.
  • Why is the parameter required if I don’t use it? — Interface contract. You can ignore the parameter, but you must accept it.

Verified against: Apex Developer Guide — Schedulable Interface. Last reviewed 2026-05-17.