function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SUJAY GANGULYSUJAY GANGULY 

Many query rows 50001 problems

SUJAY GANGULYSUJAY GANGULY
Following are the Controller code which when I deployed in production getting Many queries rows 50001 error in VF page:
SUJAY GANGULYSUJAY GANGULY
public class PaymentOpportunityExtensionController {
    Opportunity theProject = new Opportunity(); 
    List<String> OppMSNAVID= new List<String>();
    List<String> AccMSNAVID= new List<string>();
    List<String> AccountIDList= new List<String>();
    List<ID> ContactEmaiIdlist= new List<ID>();
    List<String> EmailAddress= new List<String>();
    List<Payment_Mail_c> PaymentMailList= new List<Payment_Mail_c>();
    List<Opportunity_Contact_CUSTOM_c> OpportunityContactCUSTOMList= new List<Opportunity_Contact_CUSTOM_c>();
    list<Opportunity> RACIChartList = new list<Opportunity>();
    list<Account> AccountList = new list<Account>();
    public Boolean showSubmitButton{get;set;} 
    public Boolean hideSubmitButton{get;set;} 
    public Boolean showError{get;set;}
    public String enteredText1{get;set;}
    Boolean EmailBoolean=false;
    Boolean FieldUpdate=false;
    Boolean PaymentObject=false;
    Public map<String,String> EmailSendContactmap;
    public PaymentOpportunityExtensionController(ApexPages.StandardController stdController) {        
        this.theProject = (Opportunity)stdController.getRecord();
        showSubmitButton = true;
        hideSubmitButton = false;
        showError = false;
 EmailSendContactmap= new map<String,String>();
SUJAY GANGULYSUJAY GANGULY
   Document doc=[Select Id,Name,body, contenttype, developername, type from Document WHERE Name='SSG' limit 1];
               String MsgSub = OpportunityMSNAV +' - Make Payment';
        final String chars1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; 
        String encodedData = ''; 
        while (encodedData.length() < 25) 
        { 
            Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), chars1.length()); 
            encodedData += chars1.substring(idx, idx+1); 
        }
       String Hyperlink= 'http://localhost:59490/payment/Authorize/'+encodedData;
        System.debug('Hyperlink'+Hyperlink);
        if(EmailBoolean){
                  List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
                   Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
 
SUJAY GANGULYSUJAY GANGULY
mail.setHtmlBody(messageBody);
                    mail.setSubject(MsgSub);
                    mail.setToAddresses(EmailAddress);
                    Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment();
                    List<StaticResource> docs = [select id, name, body from StaticResource where name = 'SSG_Logo' limit 1]; 
                    mails.add(mail);
                    Messaging.sendEmail(mails); 
            System.debug('messageBody'+messageBody);
           system.debug('Email ::::::::'+EmailAddress+','+'http://localhost:59490/payment/Authorize/'+OpportunityMSNAV+','+AccountMSNAV+'Random Number'+randStr);
SUJAY GANGULYSUJAY GANGULY
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Email send Successfully'));
            showSubmitButton = false;
            showError = false;
            hideSubmitButton = true;
         FieldUpdate=true;
           }
        Payment_Mail__c msinfoOne=null;
        if(FieldUpdate){
            System.debug('FieldUpdate'+FieldUpdate);
            theProject.Status__c='Payment link send';
            Update theProject;
            PaymentObject=true;
            System.debug('theProject'+theProject.Status__c);