Skip to content

Instantly share code, notes, and snippets.

@402332509
Forked from enreeco/batch_apex_class.cls
Created May 11, 2017 05:59
Show Gist options
  • Save 402332509/f3336cc8f508b0e68141d16f880558bd to your computer and use it in GitHub Desktop.
Save 402332509/f3336cc8f508b0e68141d16f880558bd 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