• SfDeveloper
  • NEWBIE
  • 10 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
List<Account> accountList = new List<Account>();
for(integer i=1; i<=10; i++){
Account a = new account();  
a.name ='sha'+i;  
a.phone='123323240'+i;  
a.annualrevenue=9096;   accountList.add(a);
}
insert accountList; 
I want to create a list of id's and print thought system.debug . how to do this?
 
for(integer i=1; i<=10; i++){
     
Account a = new account();
  a.name ='sha';
  a.phone='123';
  a.annualrevenue=9096;
  insert a;
    
}

hi, iam going to insert a multiple records using a forloop on the account object, but getting an dml exception.


User-added image
//if tried for contact object , it is getting work , may i know the reason behind it...

Thanks 
karimulla syed