Skip to content

Instantly share code, notes, and snippets.

@tyoshikawa1106
Created June 29, 2015 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyoshikawa1106/3b5bcdf8e86abebe59e5 to your computer and use it in GitHub Desktop.
Save tyoshikawa1106/3b5bcdf8e86abebe59e5 to your computer and use it in GitHub Desktop.
Standard Schedule Batch...
public with sharing class SampleBatch implements Database.batchable<sObject>, Database.Stateful {
public Database.QueryLocator start(Database.BatchableContext BC) {
String query = '';
query += ' SELECT ';
query += ' Id ';
query += ' FROM ';
query += ' Account ';
return Database.getQueryLocator(query);
}
public void execute(Database.BatchableContext BC, List<Account> accounts) {
}
public void finish(Database.BatchableContext BC) {
}
}
global class SampleBatchScheduler implements Schedulable {
global void execute(SchedulableContext SC) {
database.executebatch(new SampleBatch());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment