+ Start a Discussion
Praveen kumar TammaliPraveen kumar Tammali 

Records ?

Hi
please let me know how many recs will be inserted with below code

list<Account>acc = new list<Account>();
Account ac;
for(integer i = 0;i<10;i++){
ac = new account();
ac.Name = 'vittu'+i;
acc.add(ac);
}
insert acc;
sri sfdcsri sfdc
Hi Praveen,

10 records will insert.

To check , write a simple trigger on account object,

trigger accrecords on Account (before insert) {
 list<account> ls=trigger.new;
    for(account a :ls)
    {
        a.name='sfdc'+a.name;
        
    }
}

   

 after saving this code. 

1  Go to Debug menu and type your above code in Open Excute Anonymous Window
2  Excute 
3 Go to Account Object there you can see newly inserted 10 records 

Cheers,
Sri