Skip to main content
HI Guys I am triyng to solve this trailhead problem but i am not able to solve pls help me whats is wrong in this programme.

public class AccountHandler {

    public static Account insertNewAccount(String AccountName){

        Account acct = new Account(Name=AccountName);

        try {

            insert acct;

        } catch (DMLException e){

            return null;

        }

        return acct;

    }

}
2 answers
  1. Sep 25, 2015, 10:36 AM
    I don't see anything wrong here.. still copying my code for your reference which passed the test. 

     

    public class AccountHandler{

    public AccountHandler(){

    }

    public Static Account insertNewAccount(String accountName){

    try{

    Account newAccount = new Account(Name = accountName);

    insert newAccount;

    return newAccount;

    }

    catch(Exception e){

    return null;

    }

    }

    }

     
0/9000