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
Hanusha GanjiHanusha Ganji 

Method does not exist or incorrect signature: void insertNewAccount(String) from the type AccountHandler

Hi All, 

Method does not exist or incorrect signature: void insertNewAccount(String) from the type AccountHandler

This is the error with which i am struck from very long time.
 this is my code

public class AccountHandler {
    public Static Account insertNewAccount(String an){
        Account acc = new Account(name=an);
            try{
                insert acc;
                return acc;
            }
        catch(DMLException e){
            return null;

        }
    }
 

}

Debug :
Account acc = AccountHandler.insertNewAccount('Test Record');
Chin H.Chin H.
Hi there,
It looks ok to me. Can you try compiling all classes via Setup?
 
PriyaPriya (Salesforce Developers) 

Hi Hanusha,

I tried replicating this in my org and it is working fine. Could you please check it again. 

Regards,

Priya Ranjan

Suraj Tripathi 47Suraj Tripathi 47

Hi,

Your code is correct. Press ctrl+R to refresh the console.

after that you are getting the same error then create new class and new method and execute it. 

Don't forget to save the console.

Please mark it as the Best Answer if it helps you.

Thank You 

Hanusha GanjiHanusha Ganji
Hi All,


Thank you all for your responses!!! It's working fine now ,i am able to get the required output.