ApexSensei

Drills SOQL queries

Query one Account

SOQL reads Salesforce records into Apex.

Your task

Query the inserted Account by its Id and print what came back.

String tag = 'AS-Q301-' + UserInfo.getUserId() + '-' +
    String.valueOf(Datetime.now().getTime());
Account seeded = new Account(Name = tag);
insert seeded;

List<Account> matches = new List<Account>();
System.debug('Basic count: ' + matches.size());
System.debug('Basic name matched: false');
System.debug('Basic id matched: false');

Requirements

  1. Basic count: 1 should be built from the query result
  2. SELECT Id, Name FROM Account should be present
  3. Basic count: 1 should be printed
  4. Basic name matched: true should be printed
  5. Basic id matched: true should be printed

Sign in to open this drill