• Vijaya kavuru
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have more than 50000 records in production after applying all required filters to soql query. I have Used LIMIT, it is not helping. batch size, i have passed as 200 while execute. Still no go. I do not prefer to use Visualforce page with readonly= true. any better solution please..?

global class abc implements Database.Batchable<sObject>{
String strQuery='';     
global List<Opportunity> ListOfDeals = new List<Opportunity>();     
global List<Policy__c> listtobeUpdated = new List<Policy__c>();     
global map<string,Opportunity> Oppmap = new map<string,opportunity>();     
global Abc(){         strQuery ='SELECT Former_Policy__c,id,Opp__c FROM Policy__c WHERE Form_Policy__c != null AND opp__c = null AND Not_Belong_to_ABC__c=False AND Not_To_Be_Linked_To_Opp__c=False AND Stage__c !=Null AND Status__c != Null LIMIT 49000';     }              
global Database.QueryLocator start(Database.BatchableContext context) {                   
 return Database.getQueryLocator(strQuery);              }         global void execute(Database.BatchableContext context, List<Policy__c> policyBatch){             
  if(policyBatch.size()>0)
{              

AutoMatchRenewedPolicyHelper.autoMatchRenewedPolicy(policyBatch);          

}      
}
          global void finish(Database.BatchableContext context){     }      }
I have more than 50000 records in production after applying all required filters to soql query. I have Used LIMIT, it is not helping. batch size, i have passed as 200 while execute. Still no go. I do not prefer to use Visualforce page with readonly= true. any better solution please..?

global class abc implements Database.Batchable<sObject>{
String strQuery='';     
global List<Opportunity> ListOfDeals = new List<Opportunity>();     
global List<Policy__c> listtobeUpdated = new List<Policy__c>();     
global map<string,Opportunity> Oppmap = new map<string,opportunity>();     
global Abc(){         strQuery ='SELECT Former_Policy__c,id,Opp__c FROM Policy__c WHERE Form_Policy__c != null AND opp__c = null AND Not_Belong_to_ABC__c=False AND Not_To_Be_Linked_To_Opp__c=False AND Stage__c !=Null AND Status__c != Null LIMIT 49000';     }              
global Database.QueryLocator start(Database.BatchableContext context) {                   
 return Database.getQueryLocator(strQuery);              }         global void execute(Database.BatchableContext context, List<Policy__c> policyBatch){             
  if(policyBatch.size()>0)
{              

AutoMatchRenewedPolicyHelper.autoMatchRenewedPolicy(policyBatch);          

}      
}
          global void finish(Database.BatchableContext context){     }      }