While executing the batch, you can limit the scope of the batch class.
Example:
Below is the sample batch class
Batch Class:
global class BatchClass implements Database.Batchable<Sobject>
{
global Database.QueryLocator start(Database.BatchableContext BC){
}
global void execute(Database.BatchableContext BC, List<case> scope){
}
global void finish(Database.BatchableContext BC){
}
}
While calling the batch class in another class
BatchClass exter = new BatchClass();
database.executebatch(exter,1);
In the execute method , we can give the parameter to limit the scope.
Example:
Below is the sample batch class
Batch Class:
global class BatchClass implements Database.Batchable<Sobject>
{
global Database.QueryLocator start(Database.BatchableContext BC){
}
global void execute(Database.BatchableContext BC, List<case> scope){
}
global void finish(Database.BatchableContext BC){
}
}
While calling the batch class in another class
BatchClass exter = new BatchClass();
database.executebatch(exter,1);
In the execute method , we can give the parameter to limit the scope.
No comments:
Post a Comment