You need to sign in to do that
Don't have an account?
Adeline Moore
trailhead project Apex
I am trying to pass Quick start Apex Step two. I have copy and pasted the code given
public class OlderAcccountsUtility {
public static void updateOlderAccounts() {
// Get the 5 oldest accounts
Account[] oldAccounts = [SELECT Id, Description FROM Account ORDER BY CreatedDate ASC LIMIT 5];
// loop through them and update the Description field
for (Account acct : oldAccounts) {
acct.Description = 'Heritage Account';
}
// save the change you made
update oldAccounts;
}
but I am getting the below error message
Step Not yet complete... here's what's wrong:
The 'updateOlderAccounts' method did not update account records as expected
Note: you may run into errors if you've skipped previous steps.
Can Someone please look over what I am doing wrong?
public class OlderAcccountsUtility {
public static void updateOlderAccounts() {
// Get the 5 oldest accounts
Account[] oldAccounts = [SELECT Id, Description FROM Account ORDER BY CreatedDate ASC LIMIT 5];
// loop through them and update the Description field
for (Account acct : oldAccounts) {
acct.Description = 'Heritage Account';
}
// save the change you made
update oldAccounts;
}
but I am getting the below error message
Step Not yet complete... here's what's wrong:
The 'updateOlderAccounts' method did not update account records as expected
Note: you may run into errors if you've skipped previous steps.
Can Someone please look over what I am doing wrong?
All Answers