You need to sign in to do that
Don't have an account?

Using Batch Apex in a Scheduled way
Hi
I would like a simple answer to this. We are going to create a batch job, which will calculate some totals on a hierarchical custom object. We want the batch job to run every day. Can it be scheduled using the Scheduler? If so, does anyone have an example of how? If not, how can this be done, preferably with details?
Thx,
Hamayoun
Yes - from the help:
Batch jobs can also be programmatically scheduled to run at specific times using the Apex scheduler, or scheduled using the Schedule Apex page in the Salesforce.com user interface. For more information on the Schedule Apex page, see “Scheduling Apex” in the Salesforce.com online help.
Best,
Sati
All Answers
Yes, in Spring 10, you will be able to schedule apex code. More here.
Hope that helps,
Sati
Something like this:
Yes - from the help:
Batch jobs can also be programmatically scheduled to run at specific times using the Apex scheduler, or scheduled using the Schedule Apex page in the Salesforce.com user interface. For more information on the Schedule Apex page, see “Scheduling Apex” in the Salesforce.com online help.
Best,
Sati
So I tried this, and it does not seem to be quiet working correctly. Here is the code for my scheduledClass:
Here is the code for testBatch:
Monitoring scheduled jobs shows that the scheduled job has been submiitted (which I did via the UI) and started:
Monitoring Apex Jobs shows that the batch job is queued. As of now, it has been queued for about 18 hours.
So what is going on?