Skip to main content
2 of 3
corrected spelling

Use limit statement in query to avoid hitting governor limit... The modified query should look like-

Map<Id,Account> AccountToChangeRequest=new Map<Id,Account>([Select id,name,lastname,(Select Id,Updated__c,Lead_Merchant_Name__c,New_Value__c,Additional_Comments__c,Request_Type__c 
    from Change_Requests__r where Updated__c= False  and Lead_Merchant_Name__c!= NULL order by LastModifiedDate asc limit :Limit.getLimitQueryRows())from Account limit :Limit.getLimitQueryRows() - Limit.getQueryRows())];

Limit.getLimitQueryRows() : will return maximum number of rows can be queried. Limit.getQueryRows() :will return maximum