Sunday 24 July 2016

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){
 }


}

No comments:

Post a Comment

Batch Apex

1. What are transaction limits in apex? Total number of SOQL queries issued1 - 100 Total number of records retrieved by SOQL queries - 50...