You need to sign in to do that
Don't have an account?
Shital Somvanshi
Apex Basics & Database: Manipulate Records with DML
i am getting the following error while checking the challenge
"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"
below is my code:
public class AccountHandler{
public static Account insertNewAccount(String strName)
{
if(strName!=null)
{
Account acc=new Account(Name=strName);
try
{
insert acc;
return acc;
}
catch(DmlException e)
{
System.debug('Dml exception has occured' +e.getMessage());
return (null);
}
}
else
{
return null;
}
}
}
"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"
below is my code:
public class AccountHandler{
public static Account insertNewAccount(String strName)
{
if(strName!=null)
{
Account acc=new Account(Name=strName);
try
{
insert acc;
return acc;
}
catch(DmlException e)
{
System.debug('Dml exception has occured' +e.getMessage());
return (null);
}
}
else
{
return null;
}
}
}
You Can Try This Code
If This Solves Your Problem, Please Mark This Question as Best Answer to remove from unsolved questions.
Regards
Suraj
i have tried to check the challenge with your code, but still m getting the same error
This is the error which you have mentioned above:
"System.NullPointerException: Attempt to de-reference a null object"
Even, I have checked 'your' code in my Org, It is working fine,
Maybe Some of your Trigger or Process maybe active, which may cause an error
then, Please Make Sure Any Trigger or Process must not be active before checking challenge.
Regards
Suraj
Please check once below code:
If any other trigger is there on account object please deactivate and check once.Maybe some triggers are firing.
Thanks
Varaprasad
can u guide me about how to deactivate triggers on account object?
Please check once below screenshot.