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
rupesh ranjanrupesh ranjan 

 write Batch Class for this code?

 write Batch Class for this code? 
more thn 50001 record..
Public  class  selectcontact{ 
    public String to{get; set;}
    public String AddRecep{get; set;}
    public String subject {get; set;}
    public String body {get; set;}
public List<wrapContact> wrapContactList {get; set;}
    public List<Contact> selectedContacts{get;set;}
    Public String selectId {get;set;}
    public selectcontact(){
        body = apexpages.currentpage().getparameters().get('att');
     
            if(wrapContactList == null) {
            wrapContactList= new List<wrapContact>();
            for(Contact a: [SELECT  Name,FirstName,LastName,Email,Title FROM Contact ORDER by Name ASC]) {
                wrapContactList.add(new wrapContact(a));
           }
        }
        
       
        body = '';         
      
    }         
    public void processSelected() {
        AddRecep = '';
        selectedContacts = new List<Contact>();
        for(wrapContact wrapContactObj : wrapContactList) {
            if(wrapContactObj.selected == true) {
                selectedContacts.add(wrapContactObj.acc);
                if (AddRecep == '') {
                    AddRecep = wrapContactObj.acc.Email;
                } else {
                    AddRecep += ';' + wrapContactObj.acc.Email ;
                }
            }
        }
    }
    public class wrapContact {
        public Contact acc {get; set;}
        public Boolean selected {get; set;}
        public wrapContact (Contact a) {
            acc = a;
            selected = false;
        }
    }   
}

 
James LoghryJames Loghry
What is the actual question here?  Yes, 50,000+ records screams some sort of batch or asynchronous processing.  However, are you really expecting users to select 50,000 contacts on a visualforce page?  Please provide some context around your question and perhaps we can help.  In the mean time, you might want to go through the Apex Asynchronous module in trailhead: https://developer.salesforce.com/trailhead/en/asynchronous_apex/async_apex_batch