You need to sign in to do that
Don't have an account?
AMRITA AGARWALA 2
Why the Trailhead Challenge for Manipulating Records with DML dont pass?
This is my code:
public class AccountHandler {
public static Account insertNewAccount(String name){
try{
Account acc = new Account();
acc.Name = name ;
insert acc ;
system.debug(acc.Id);
return acc;
}catch (DmlException e) {
System.debug('A DML exception has occurred: ' + e.getMessage());
return null;
}
}
}
public class AccountHandler {
public static Account insertNewAccount(String name){
try{
Account acc = new Account();
acc.Name = name ;
insert acc ;
system.debug(acc.Id);
return acc;
}catch (DmlException e) {
System.debug('A DML exception has occurred: ' + e.getMessage());
return null;
}
}
}
This way you always return a value since the return is the last line.
Curious why I'm not able to get this to run. Any ideas?
NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.