Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I've got an Apex Class that implements System.Schedulable which I'm trying to run:

public class Broker {

    //...

    public class Worker implements System.Schedulable {
        public void execute(SchedulableContext context) {
            //fail hard
            System.assert(false, 'CHOO CHOO');
        }
    }

    //...

}

I'm invoking it with the usual trick to run momentarily:

//leave a bit of space, eg '36 53 9 9 8 ? 2014'
DateTime now = System.now().addSeconds(5);
String cron = now.second() + ' ' + now.minute() + ' ' + now.hour() + ' ' + now.day() + ' ' + now.month() + ' ' + '?' + ' ' + now.year();

//schedule for execution
Broker.Worker schedule = new Broker.Worker();
System.schedule('Worker for ' + cron, cron, schedule);

First, I can see it in my Scheduled Apex monitor:

scheduled-apex

And second, I see it progress after a couple seconds from Next Scheduled Run to Started:

scheduled-jobs

But it appears to be disappearing into oblivion! The job goes to Completed without a trace, leaves no side effects, and no entry in the Debug Log under any user.

Am I missing anything here?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

This appears to be a Salesforce bug.

As a work around, promote your System.Schedulable class from an inner to an outer class.

(If it is in fact officially not supported for an inner class, perhaps someone could post the Salesforce documentation reference.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.