I am facing the subject mentioned error in the Apex (Add a method to the class). I have written the code exactly as mentioned in the section.
4 件の回答
I has the same issue but i found that i has a missing class OlderAccountsUtility. So i fixed it and the correct way is:
public class OlderAccountsUtility {
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;
}
}