I'm really hoping someone can help me here. I have tried numerous times with this code but still get the same error. I have even used other code I have found on-line that apparently 'works', but with the same error.
Below is an example of someone else's code (not mine) that they say works, but unfortunately not for me. Why is it that I am still getting the same error even with this?
public class AccountHandler {
public static Account insertNewAccount(string AcctName)
{
try{
Account acct=new Account(Name=AcctName);
insert acct;
return acct;
}
catch (DMLException e)
{
System.debug('A DML exception has occurred: ' +
e.getMessage());
return (NULL);
}
}
}
return
twice, which you can't do in apex. I should be making this an answer but I don't know if this solution, I just know it would cause a problem by having two returns