function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
List<Account> acclist = new List<Account>(); For(Integer i=1;i<=1000;i++){ Account acc= new Account(); acc.name='sample account'+i; if(i>=1 && i<=400){ acc.AnnualRevenue=500; } else if(i>400 && i<=800){ acc.AnnualRevenue=1000; } else{ acc.AnnualRevenue=2000; } acclist.add(acc); } insert acclist;
Are you using annual revenue standard field?
Thanks,
If there are no other automachines you can use below code.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
public class contacts_1000 {
public static void method1()
{
list<contact> cons = new list<contact>();
for(integer i=1;i<=100;i++)
{
contact con = new contact();
if(i<=40)
{
con.lastname='con'+i;
con.Email ='sai'+i+'@gmail.com';
con.Phone='95420';
}
else if(i>40 && i<=80)
{
con.lastname='con'+i;
con.Email ='sai'+i+'@gmail.com';
con.Phone='960323';
}
else{
con.lastname='con'+i;
con.Email ='sai'+i+'@gmail.com';
con.Phone='984898';
}
cons.add(con);
}
insert cons;
}
}