Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
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
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){}
}
Hi,
Thanks for your fast answer.
When I try to save. It returns: Invalid Type: Database.QueryLocator
Any idea?
ya you have tp change the implement statement
global class batchClass implements Database.batchable<sObject>
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){}
}
Hi,
Thanks for your fast answer.
When I try to save. It returns: Invalid Type: Database.QueryLocator
Any idea?
Thanks in advance
ya you have tp change the implement statement
global class batchClass implements Database.batchable<sObject>