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.
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
1. As mentioned in https://dfc-org-production--c.vf.force.com/apex/ForumsMain?id=9062I000000R5tvQAC
You can try the below code snippet Run the below code from anonymous
InsertLead IL= new InsertLead();
IL.insertleadmethod();
2. To Insert 200 Hiring Manager Records, try the below code. 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