Skip to main content
Bumped by Community user
Bumped by Community user
edited tags
Link
Adrian Larson
  • 151.4k
  • 38
  • 247
  • 431
Source Link
Shantanu Mahajan
  • 984
  • 4
  • 22
  • 46

How to retrieve more than 50000 Records in a single query

I am running Batch Class for Migration of Records for Particular Object and I am storing Failed Records in an another Object. Now I have run the Batch and I got 1,00,000+ Records which are Failed. But Using the SOQL I can only get 50000 records. Following is the query for getting Failed Records.

SELECT Id, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, Record_ID__c, Record_Name__c, Error__c,Batch_Result__r.Batch_Id__c FROM Batch_Status__c where Batch_Result__r.Batch_Id__c =:strBatchId

Thanks in Advance!!