function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AbanteAbante 

Batch Processing for Dummies

Hello everyone,

 

Please, clould anyone show me how to update all the leads with batch processing in a very easy and simple way?

 

Thanks in advance

 

Javier Jiménez

kiranmutturukiranmutturu

global class batchClass implements Database.batchable{

global Database.QueryLocator start(Database.BatchableContext info){

return [select id from lead];

}

global void execute(Database.BatchableContext info, List<lead> scope){

List<lead> leadsToUpdate = new List<lead>();

for(lead a : scope){

a.fieldtoupdate = 70;

leadsToUpdate.add(a);

}

update leadsToUpdate;

}

global void finish(Database.BatchableContext info){}

}

AbanteAbante

Hi,

 

Thanks for your fast answer. 

 

When I try to save. It returns:  Invalid Type: Database.QueryLocator

 

Any idea?

 

Thanks in advance

kiranmutturukiranmutturu

ya you have tp change the implement statement

 

 

global class batchClass implements Database.batchable<sObject>