Hi Prashanth,I have used the below code i anonomous code and it did not throw any error. DMLhelper.createBulkprospects();
In the code you are not adding lead to the list so leads were not creating. Updated the code as below.
If this solution helps, Please mark it as best answer.Thanks,public class DMLhelper
{
public static void createBulkprospects()
{
List<Lead>lstleads=new List<Lead>();
for(integer counter=1;counter<=100;counter++)
{
Lead ld = new Lead();
ld.firstname='Bulk';
ld.LastName='Lead record'+counter;
ld.Company='salesforce INC';
ld.Status='Warm';
ld.Industry='Technology';
ld.phone='9900998877';
ld.fax='9900778899';
ld.Email='bulked'+counter+'@gmail.com';
ld.LeadSource='Web';
lstleads.add(ld);
}
if(!lstleads.isempty())
Insert lstleads;
system.debug('number of DML statements used..:'+Limits.getDmlStatements());
}
}
1 respuesta