function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rameshramesh 

insert 1000 account recrod with first 400 annual revenu is 500, next 400 record 1000 next 200 is 2000

Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Are you using annual revenue standard field?

Thanks,
 
rameshramesh
s
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Saki,

If there are no other automachines you can use below code.
 
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;

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,
rameshramesh
Thanks working
rameshramesh
for test class 

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;
    }
}