Task
Create a New Contact for Bank Of America Account.
Solution
List<Account> bankOfAmericaAccounts = [SELECT Id FROM Account WHERE Name = 'Bank Of America' LIMIT 1];
if (bankOfAmericaAccounts.size() != 0) {
Contact newContact = new Contact();
newContact.FirstName = 'John';
newContact.LastName = 'Smith';
newContact.AccountId = bankOfAmericaAccounts[0].Id;
insert newContact;
System.debug('Contact created and related to the Bank Of America account.');
} else {
System.debug('Bank Of America account not found.');
}
Video
Video does not exists.