public class AccountHandler {
Public static void insertAccount(integer value)
{
integer counter=1;
List<Account> addAccounts=new List<Account>();
while(counter<=value)
{
system.debug('counter value before increment'+counter);
Account acc1=new Account();
acc1.Name='Acme Inc n'+counter;
acc1.AccountNumber='A000'+counter;
addAccounts.add(acc1);
//System.debug(addaccount);
//increment the counter
counter = counter + 1;
System.debug('Counter Value after incrementing ' + counter);
}
insert addAccounts;
system.debug(addAccounts);
}
}
Public static void insertAccount(integer value)
{
integer counter=1;
List<Account> addAccounts=new List<Account>();
while(counter<=value)
{
system.debug('counter value before increment'+counter);
Account acc1=new Account();
acc1.Name='Acme Inc n'+counter;
acc1.AccountNumber='A000'+counter;
addAccounts.add(acc1);
//System.debug(addaccount);
//increment the counter
counter = counter + 1;
System.debug('Counter Value after incrementing ' + counter);
}
insert addAccounts;
system.debug(addAccounts);
}
}
No comments:
Post a Comment