You need to sign in to do that
Don't have an account?
jayaramu Talapala
Can any one help on this error?
Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: Attempt to de-reference a null object
my code is :
public class AccountHandler {
public static Account insertNewAccount (String accName){
if(accName!=''){
try{
Account a = new Account(Name=accName);
insert a;
System.debug(' Account created');
return a;
} catch(Exception e){
System.Debug('Account not created');
return null;
}
} else {
return null;
}
}
}
There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: Attempt to de-reference a null object
my code is :
public class AccountHandler {
public static Account insertNewAccount (String accName){
if(accName!=''){
try{
Account a = new Account(Name=accName);
insert a;
System.debug(' Account created');
return a;
} catch(Exception e){
System.Debug('Account not created');
return null;
}
} else {
return null;
}
}
}
public class AccountHandler {
public static Account insertNewAccount(String name){
try{
Account acct = new Account(Name=name);
insert acct;
return acct;
}
catch(DmlException de){
System.debug('Exception :'+de.getMessage());
return null;
}
}
}
All Answers
try this ones
Thanks
let me inform if it work and mark it best answer if it helps you :)
public class AccountHandler {
public static Account insertNewAccount(String name){
try{
Account acct = new Account(Name=name);
insert acct;
return acct;
}
catch(DmlException de){
System.debug('Exception :'+de.getMessage());
return null;
}
}
}
Challenge not yet complete in Resilient Badger Playground
There was an unexpected error in your org which is preventing this assessment check from completing: System.NullPointerException: Attempt to de-reference a null object
Help me