Deleting the records in "Salesforce using Batch Class":
global class DeleteLeadRecord implements Database.batchable<sobject>{
global database.querylocator start(Database.BatchableContext BC){
String query = 'Select id from Lead where leadsource=\'Purchased - Raw\' AND isconverted=false';
return database.getqueryLocator(query);
}
global void execute(Database.BatchableContext BC, list<Lead> leadList){
if(!leadlist.isEmpty()){
delete leadList;
}
}
global Void finish(Database.BatchableContext BC){
}
}
global class DeleteLeadRecord implements Database.batchable<sobject>{
global database.querylocator start(Database.BatchableContext BC){
String query = 'Select id from Lead where leadsource=\'Purchased - Raw\' AND isconverted=false';
return database.getqueryLocator(query);
}
global void execute(Database.BatchableContext BC, list<Lead> leadList){
if(!leadlist.isEmpty()){
delete leadList;
}
}
global Void finish(Database.BatchableContext BC){
}
}
No comments:
Post a Comment