Batchable Interface

The class that implements this interface can be executed as a batch Apex job.

Namespace

Database

Batchable Methods

The following are methods for Batchable.

execute(Database.BatchableContext, List<sObject>)

Gets invoked when the batch job executes and operates on one batch of records. Contains or calls the main execution logic for the batch job.

Signature

public Void execute(Database.BatchableContext context, List<sObject> scope)

Parameters

context
Type: Database.BatchableContext
Contains the job ID.
scope
Type: List<sObject>
Contains the batch of records to process.

Return Value

Type: Void

finish(Database.BatchableContext)

Gets invoked when the batch job finishes. Place any clean up code in this method.

Signature

public Void finish(Database.BatchableContext context)

Parameters

context
Type: Database.BatchableContext
Contains the job ID.

Return Value

Type: Void

start(Database.BatchableContext)

Gets invoked when the batch job starts. Returns the record set as an iterable that will be batched for execution.

Signature

public System.Iterable start(Database.BatchableContext context)

Parameters

context
Type: Database.BatchableContext
Contains the job ID.

Return Value

Type: System.Iterable

start(Database.BatchableContext)

Gets invoked when the batch job starts. Returns the record set as a QueryLocator object that will be batched for execution.

Signature

public Database.QueryLocator start(Database.BatchableContext context)

Parameters

context
Type: Database.BatchableContext
Contains the job ID.

Return Value

Type: Database.QueryLocator

© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.