Skip to content

Instantly share code, notes, and snippets.

@enreeco
Created December 20, 2016 13:44
Show Gist options
  • Save enreeco/2bb77de86f3489a4a3db5792d0c4e7d6 to your computer and use it in GitHub Desktop.
Save enreeco/2bb77de86f3489a4a3db5792d0c4e7d6 to your computer and use it in GitHub Desktop.
Batch Apex Class
/**
* Title
*
* @author
* @version 1.0
* @description
* @uses
* @history
* yyyy-mm-dd :
*/
public without sharing class MyBatch implements Database.Batchable<sObject>, Database.Stateful, Schedulable, Database.AllowsCallouts {
public Iterable<sObject> start(Database.BatchableContext bc) {
return Database.getQueryLocator([Select Id From XXXX ...]);
}
public void execute(Database.BatchableContext bc, List<SObject> scope) {
for(SObject obj : scope){
}
}
public void finish (Database.BatchableContext bc) {
}
public void execute(SchedulableContext SC) {
Database.executeBatch(new MyBatch(), 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment