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
PAWAN THOSARPAWAN THOSAR 

create new 20 Accounts record in salesforce with atleast five fields

Arun Kumar 1141Arun Kumar 1141

Hi Pawan,
 
public class CreateAccounts {
    public static void createAccounts() {
        try {
            List<Account> accountList = new List<Account>();
            
            for (Integer i = 1; i <= 20; i++) {
                Account acc = new Account(
                    Name = 'Account ' + i,
                    Industry = 'Technology',
                    Type = 'Prospect',
                    Rating = 'Hot',
                    Website = 'https://www.example.com'
                );
                
                accountList.add(acc);
            }
            
            insert accountList;
        } catch (Exception ex) {
            System.debug('An error occurred while creating accounts: ' + ex.getMessage());
        }
    }
}

Hope this will help.
Thanks!
SwethaSwetha (Salesforce Developers) 
HI Pawan,
Adding to above, you could also use the Salesforce Data Import Wizard or the Salesforce Data Loader tool to create the 20 new Accounts records with fields data of your choice.

Basically, in dataloader context, you need to create a CSV file that includes the necessary fields for creating Account records. Each row represents an Account, and each column represents a field. Make sure you include at least five fields, such as Name, Industry, Phone, Website, and BillingCity. Save the file in CSV format.

Select "Insert" as the operation and upload the CSV followed by field mapping. Once the mapping is complete, click on the "Next" button. Review the summary and click "Finish" to start the insertion process.

If this information helps, please mark the answer as best. Thank you
PAWAN THOSARPAWAN THOSAR
but i need to try in coding