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
PAWAN THOSARPAWAN THOSAR 

Assignment on DML Operations 1. Write an apex Class, to Insert a Lead Record inside the Object. 2. Write an apex program, to Insert 200 Hiring Manager Records inside the Object.

Best Answer chosen by PAWAN THOSAR
SwethaSwetha (Salesforce Developers) 
HI Pawan,
1. As mentioned in https://dfc-org-production--c.vf.force.com/apex/ForumsMain?id=9062I000000R5tvQAC

You can try the below code snippet
public class InsertLead {
    public void insertleadmethod(){
        Lead ls= new Lead();
        ls.lastname='sample lead';
        ls.FirstName='first name';
        ls.Company='sample company';
        ls.Email='sample@gmail.com';
        insert ls;
    }
}
Run the below code from anonymous

InsertLead IL= new InsertLead();
IL.insertleadmethod();

2. To Insert 200 Hiring Manager Records, try the below code.
public class InsertHiringManager {
    
    public void insertHManager(){
        List< Hiring_Manager__c > hm= new List<Hiring_Manager__c> ();
        For( Integer I=0; I<200;i++){
        Hiring_Manager__c  ls= new Hiring_Manager__c ();
       Ls.name='sample'+i;
       hm.add(ls);
        }
        insert hm;
        
    }

}
You can execute the below code in the anonymous window so records get inserted.

InsertHiringManager IL= new InsertHiringManager();
IL.insertHManager();

If this information helps, please mark the answer as best. Thank you