Salesforce: Universal Batch Scheduling Class
I’d like to propose a new way of working with scheduled batch classes. I’ve worked on several hundred Salesforce projects in the past few years and often see batch scheduling classes being created per scheduling requirement and it grinds my OCD – not in a good way. In most cases you should only need one “Batch Scheduler” per Org, let me demonstrate how and why. The Universal Batch Scheduler™ Requirements Let’s assuming you have a batch class that you need to run on a repeated schedule*, such a class signature is given below. That class will have to obey some conventions such as implementing the Batchable interface as shown in the standard documentation. [code language=”Java”] global class MyBatch implements Database.Batchable<SObject> { // … } [/code] * For one off, schedule execution of batch classes you can use the System.ScheduleBatch() method. The Scheduler Now you might be tempted to created a scheduled …