Create/Insert multiple records

Create/Insert multiple records-


public class multipleRecords{

public void aMethod(){

List<Lead> l = new List<Lead>();

Lead c;

for(Integer i=0;i<=200;i++){

c = new Lead(LastName ='Testing'+string.valueof(i),Company='Company'+string.valueof(i));

l.add(c);

}

insert l;

}

}


In Developer Console - Anonymous Window - Run -

multipleRecords mR=new multipleRecords(); mR.aMethod();





Comments