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

Batch APEX not running
Hello Apex experts!
After a recent scheduled maintenance of SalesForce, we have a batch apex that no longer runs.
The batch is scheduled for every morning on 07:00 AM, and no other batches are running at the same time. (We also have a batch that runs on 00:00).
What wierd is that if we schedule it to run one time it does run and also it runs if we fire it from the code.
Below is the code that excutes the batch.
Any ideas? Thanks!
global void execute(SchedulableContext SC){
Messaging.Singleemailmessage mail = new Messaging.Singleemailmessage();
mail.setHtmlBody(htmlBody());
mail.setToAddresses(new list<string>{'emil.somekh@solidcam.com','eddie.pevzner@solidcam.com','natalie.somekh@solidcam.com','david.somekh@solidcam.com'});
mail.setSubject('SolidCAM seats summary report');
Messaging.sendEmail(new Messaging.Singleemailmessage[] { mail});
return;
}
After a recent scheduled maintenance of SalesForce, we have a batch apex that no longer runs.
The batch is scheduled for every morning on 07:00 AM, and no other batches are running at the same time. (We also have a batch that runs on 00:00).
What wierd is that if we schedule it to run one time it does run and also it runs if we fire it from the code.
Below is the code that excutes the batch.
Any ideas? Thanks!
global void execute(SchedulableContext SC){
Messaging.Singleemailmessage mail = new Messaging.Singleemailmessage();
mail.setHtmlBody(htmlBody());
mail.setToAddresses(new list<string>{'emil.somekh@solidcam.com','eddie.pevzner@solidcam.com','natalie.somekh@solidcam.com','david.somekh@solidcam.com'});
mail.setSubject('SolidCAM seats summary report');
Messaging.sendEmail(new Messaging.Singleemailmessage[] { mail});
return;
}
The code which you pasted, just only send email, there is no statement for exceuting batch. Please check once.
Thanks,
Neetu
It's a "Scheduled job" not a batch apex. It implements "Schedulable" like explained here:
http://salesforce.stackexchange.com/questions/24446/how-to-deploy-apex-classes-that-are-scheduled
Thanks,
David
In this link, if you check this code: It is written to execute batch class. Like if your batch class name is TestBatch then you need to call that batch in the execute method like: For more information, please go through this link:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm
Let me know, if you need any other help.
Thanks,
Neetu
Hello Neetu,
You don't have to call a batch, this is from the link you sent:
The following example implements the Schedulable interface for a class called mergeNumbers:
1 global class scheduledMerge implements Schedulable {
2 global void execute(SchedulableContext SC) {
3 mergeNumbers M = new mergeNumbers();
4 }
Any idea why my code is still not running every day?
Thanks,
David
Yes you can either call batch, or any other class in the execute method, but your code is just calling code of sending Email. You need to call the class into it, to schedule it regularly.
If you still not able to figure it out, you can provide me your login credentials and I will have a look. You can contact me either on my skype id: neetu.bansal.5 or email id: neetu.bansal.5@gmail.com
Thanks,
Neetu
I have added you in Skype.
I have a schedules job that is calling this class everyday. Is that what you meant?
Thanks,
David