Create an Apex class that returns Account objects

To pass this challenge, create an Apex class that returns a List of Account objects for a user-specified state.
  • Create an Apex class named AccountUtils and include a static method named accountsByState that accepts a state abbreviation as a string and returns a List of Account objects
  • The method must return the ID and name of all Account objects that match the BillingState for the state abbreviation passed to the method

Write an Apex trigger that modifies Account fields before inserting records

Write an Apex trigger that fires before records are inserted and ensures that the ShippingState field has the same value as the BillingState field.
  • Create an Apex class named AccountTriggerHandler that contains a public static method called CreateAccounts to accept the List of Account objects
  • For each Account record, before saving, ensure that the ShippingState field has the same value as the BillingState field
  • Write an Apex trigger named AccountTrigger that fires before records are inserted
  • The Apex trigger must call the AccountTriggerHandler.CreateAccounts() method with the collection of new records
  • Make sure you use the isBefore and isInsert trigger context variables
  • Create a test class named AccountTriggerTest that inserts 200 Account records with a BillingState of CA. After the insert, test to ensure that all 200 records have a ShippingState of CA
  • Before verifying this challenge, run your test class at least once using the Developer Console Run All feature.