• Andres Schmois
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
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.
I've been coding in a sandbox and figuring out how to schedule jobs through Apex and I ran into a few errors where I was receiving an error "Based on configured schedule, the given trigger will never fire". Anyways after a bit of changing code around and finding out why I was getting that, I went into my scheduled jobs and now I have a couple orphaned AsyncApexJobs that I cannot delete because they do not belong to a parent cron trigger. I've seen a few of these errors on the forums and all answers say that Salesforce backend team had to delete the jobs themselves.

If you want to reproduce this error: Call System.schedule with a cron trigger in the past, and you will get a stuck job.

I need some help from someone in the Salesforce team to delete the orphaned AsyncApexJobs.

Related: https://developer.salesforce.com/forums/?id=906F0000000BOuqIAG
Related 2: http://avionsalesforce.blogspot.com/2016/03/how-to-terminate-asyncapexjob-exception.html
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.
I've been coding in a sandbox and figuring out how to schedule jobs through Apex and I ran into a few errors where I was receiving an error "Based on configured schedule, the given trigger will never fire". Anyways after a bit of changing code around and finding out why I was getting that, I went into my scheduled jobs and now I have a couple orphaned AsyncApexJobs that I cannot delete because they do not belong to a parent cron trigger. I've seen a few of these errors on the forums and all answers say that Salesforce backend team had to delete the jobs themselves.

If you want to reproduce this error: Call System.schedule with a cron trigger in the past, and you will get a stuck job.

I need some help from someone in the Salesforce team to delete the orphaned AsyncApexJobs.

Related: https://developer.salesforce.com/forums/?id=906F0000000BOuqIAG
Related 2: http://avionsalesforce.blogspot.com/2016/03/how-to-terminate-asyncapexjob-exception.html