• Zulfira Sabirova
  • 0 Points
  • Member since 2023

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
This is what my code is suppose to be doing: 
To pass this challenge, create an Apex class that inserts a new account named after an incoming parameter. If the account is successfully inserted, the method should return the account record. If a DML exception occurs, the method should return null.

public class AccountHandler {

    public static Account insertNewAccount(String accName){
                Account a = new Account(Name=accName);
                insert a;    
                return a;
            } catch(Exception e){
                return null;
        } else {
        return null;

When I test it inside of the execute anonymous window, I input "insertNewAccount('abcd');". I get an error saying "Method does not exist or incorrect signature: void insertNewAccount(String) from the type anon"