Notes
To update a specific lead:
Lead ld = [SELECT Id FROM Lead WHERE Id='00Q8c00001297fTEAQ'];
ld.email='updated@gmail.com';
update ld;
To update all the leads:
List<Lead> ldList = [SELECT Id FROM Lead];
for(Lead ld : ldList){
ld.email='updated@gmail.com';
}
update ldList;
To update all the leads whose status is "Open - Not Contacted
":
List<Lead> ldList = [SELECT Id FROM Lead WHERE Status ='Open - Not Contacted'];
for(Lead ld : ldList){
ld.email='updated2@gmail.com';
}
update ldList;