You need to sign in to do that
Don't have an account?
Rica Saporta
Troubles with Trailhead challenge: Apex Basics & DB, Manipulating Records with DML
hello all,
i have having issues with this challange and am not sure how to get past them ...below is a screen capture of the challange and my latest error.
here is the code i have ...
==================
public class AccountHandler {
public static Account insertNewAccount(String AcctName) {
Account acct = new Account();
if (AcctName <> ''){
acct.Name = AcctName;
return acct;
} else {
return Null;
}
}
}
===============
i have already started a new Development Environment to try and get rid of the "org" related issue, but this did not help .. obviously i am doing something very basic wrong ...
HELP
thank you
rica
i have having issues with this challange and am not sure how to get past them ...below is a screen capture of the challange and my latest error.
here is the code i have ...
==================
public class AccountHandler {
public static Account insertNewAccount(String AcctName) {
Account acct = new Account();
if (AcctName <> ''){
acct.Name = AcctName;
return acct;
} else {
return Null;
}
}
}
===============
i have already started a new Development Environment to try and get rid of the "org" related issue, but this did not help .. obviously i am doing something very basic wrong ...
HELP
thank you
rica
1) https://developer.salesforce.com/forums/?id=906F0000000B37aIAC
2) https://developer.salesforce.com/forums/?id=906F0000000BH6yIAG
This method takes name string parameter and makes a new Account. Then it tries to insert it, but if insert fails then it returns null. If insert succeeds, it will return that account object. NOTE:- your DML should be inside Try Catch.
Let us know if this will help you
Thanks
Amit Chaudhary
All Answers
Please check the below code:
Hope this helps you!
Best Regards,
Deepthi
1) https://developer.salesforce.com/forums/?id=906F0000000B37aIAC
2) https://developer.salesforce.com/forums/?id=906F0000000BH6yIAG
This method takes name string parameter and makes a new Account. Then it tries to insert it, but if insert fails then it returns null. If insert succeeds, it will return that account object. NOTE:- your DML should be inside Try Catch.
Let us know if this will help you
Thanks
Amit Chaudhary
==========
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
==========
not sure what to do next - it's the "Attempt to de-reference a null object" that is really throwing me off
i tried again and this time made sure i was pointing to the right DE (i.e. the new one) and this time the code provided by Amit worked ...
thank you kindly for the assistance
rica