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
public class AccountCreated { public static void createAccount() { Integer i; Integer k; List<Account> accList = new List<Account>(); List<Order> orderList = new List<Order>(); for(i=1; i<=10; i++) { Account accObject = new Account(Name='Account'+i); accObject.Name = 'cde' + i; accList.add(accObject); system.debug('accList----->'+accList); } insert accList; for(Account acc : accList) { for(k =1; k<=5; k++) { Order orderObject = new Order(); orderObject.Name = 'abc'+ k; orderObject.AccountId = acc.Id; orderObject.EffectiveDate = Date.today(); orderObject.Status = 'Draft'; orderList.add(orderObject); } system.debug('orderList----->'+orderList); } insert orderList; } }
You can use this example to create 10 account s and each account have 50 orders:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi