i have soql in Apex trigger where as it is fetching the all the records of test object. SOQl is fetching more than 50000 records so when ever i am updating the records i am facing this governor limits error . please let me know how to solve this error.
List<test__c> ocrInformation = new List<test__c>();
Map<String,String> Opporgcode=new Map<String,String>();
ocrInformation= [select id,Team__c,Org__c from test__c];//facing an error here
for(test__c oct: ocrInformation){
Opporgcode.put(oct.Org__c,oct.Team__c);
}
It's standard Salesforce limitation
total number of records retrieved by SOQL queries = 50,000
Do you really need to select all test__c records? Possibly, you could reduce amount of retrieved data with help op where
or limit
conditions. If not, you can try to use Batch Apex. It allows the 50k limit counts per batch execution.