function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andres SchmoisAndres Schmois 

Nested Schedulable Class

I have a class that has two nested schedulable classes. Compilation gives me no troubles and the schedule interface gives me no trouble either. If I don't nest them the schedule works just fine.
 
global class NestedSchedulable Class {

    global class Class1 implements Schedulable {
        global void execute(SchedulableContext ctx) {
            // Single method call
        }
    }

    global class Class2 implements Schedulable {
        global void execute(SchedulableContext ctx) {
            // Single method call
        }
    }
}

No matter what I do (other than separating the classes) the schedule will just not run.

The Scheduled Jobs list says that it started when it should have started and the next starting time is the correct one, but the history (and the stuff it's supposed to be doing) just don't show up. I believe it's a problem with the Salesforce platform, but I'm posint here in hope that I'm just missing something.

To schedule the classes I use the following method: 
 
// Run every day at 4 am indefinitely
System.schedule('Example job name', '0 0 4 * * ?', new NestedSchedulable.Class1());
System.schedule('Example job name 2', '0 0 4 * * ?', new NestedSchedulable.Class2());

If I do everything the same without nested classes it works.
Andres SchmoisAndres Schmois
Typo in the first code block: `NestedSchedulable Class` should say `NestedSchedulable`