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
Mahendra Kumar 26Mahendra Kumar 26 

Receiving an error message "Method does not exist or incorrect signature: void InsertBulkAccounts() from the type DMLUtility'

Hi Guys, I'm a newbie for Salesforce...

I'm trying to insert 200 Account record through Bulkification process...However I get the above message...I'm just practicing the below code...I'm unable to execute...please help....
Here is the code...

public class DMLUtility 
{
  Public Static void InsertBulkAccounts()
  {
      //Insert 200 Account records...Always use bulkification process...
      
      List<Account> lstAccounts = new List<Account>(); 
      
      for(integer counter = 1; counter <=200; counter ++)
      {
          //Create an account record..
Account acc = new Account();
          
          acc.Name = 'Bulk Accounts - '+ counter;
          acc.Rating = 'Hot'; 
          acc.AnnualRevenue = 2000000;
          acc.Industry = 'Finance'; 
          acc.Type = 'Open - Direct';  
          acc.Ownership = 'Public'; 
          acc.Site = '554544'; 
          acc.CustomerPriority__c = 'high';  
          acc.Active__c = 'Yes'; 
          
          //Add the record
          lstAccounts.add(acc); 
          
      }
      //Insert the collection of records....
      if(! lstaccounts.isEmpty())
      {
          insert lstAccounts;  
      }
  }
}

Thanks in advance
Harish DHarish D
Hi Mahendra,

You have not mentioned how you are calling the method: InsertBulkAccounts.  Since InsertBulkAccounts is a static method you should be able to execute that method with this snippet:
 
DMLUtility.InsertBulkAccounts();

Thanks,
Harish
Mahendra Kumar 26Mahendra Kumar 26
Hi Harish, 

Yes, I'm using the above method to call.

Thanks in advance....