• Brandon Brown
  • NEWBIE
  • 15 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Well, all I can say is that it does add an account, and if you send it a blank string, it does return a NULL, so I am wondering what I did wrong. Here is the code:

public class AccountHandler {

    public static ID  insertNewAccount(String myStr) {
        try {
            Account acct = new Account(Name=myStr);
            insert acct;
            
            return(acct.id);
            
        } catch (DmlException e) {
            System.debug('A DML exception has occurred:' + e.getMessage());
            return(NULL);
        }
        
    }
            
}

Thanks in advance for the help,

Feeling dumb
Well, all I can say is that it does add an account, and if you send it a blank string, it does return a NULL, so I am wondering what I did wrong. Here is the code:

public class AccountHandler {

    public static ID  insertNewAccount(String myStr) {
        try {
            Account acct = new Account(Name=myStr);
            insert acct;
            
            return(acct.id);
            
        } catch (DmlException e) {
            System.debug('A DML exception has occurred:' + e.getMessage());
            return(NULL);
        }
        
    }
            
}

Thanks in advance for the help,

Feeling dumb