fork download
  1. public class CaseHelper {
  2. public static List<String> getOpenCasesWithAccountPhone() {
  3. List<String> result = new List<String>();
  4.  
  5. // Query open Case records, sorted by LastModifiedDate in descending order, limited to 100 records
  6. List<Case> openCases = [
  7. SELECT Subject, Account.Phone
  8. FROM Case
  9. WHERE Status = 'Open'
  10. ORDER BY LastModifiedDate DESC
  11. LIMIT 100
  12. ];
  13.  
  14. // Process each case and format the output
  15. for (Case c : openCases) {
  16. String accountPhone;
  17.  
  18. if (c.Account == null) {
  19. accountPhone = 'No Account';
  20. } else if (c.Account.Phone == null) {
  21. accountPhone = 'No Phone';
  22. } else {
  23. accountPhone = c.Account.Phone;
  24. }
  25.  
  26. result.add('Case Subject: ' + c.Subject + ', Account Phone: ' + accountPhone);
  27. }
  28.  
  29. return result;
  30. }
  31. }
  32.  
Success #stdin #stdout #stderr 0.01s 9016KB
stdin
Standard input is empty
stdout
Object: UndefinedObject error: did not understand #CaseHelper
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject class(Object)>>doesNotUnderstand: #CaseHelper (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:2: parse error, expected '}'