ApexSensei

Drills Triggers

React to a Contact email change

An update trigger sees the new record in Trigger.new and the saved one in Trigger.oldMap, keyed by Id.

Your task

Complete beforeUpdate so a Contact's Description becomes 'Email changed' only when its Email actually changes.

public class AS_7BE5BEFCF051_ContactChanges {
    public static void beforeUpdate(List<Contact> newContacts, Map<Id, Contact> oldMap) {
        for (Contact contact : newContacts) {
            Contact oldContact = oldMap.get(contact.Id);
        }
    }
}

Requirements

  1. marksChangedEmail should pass
  2. keepsUnchangedEmail should pass
  3. handlesNullToValue should pass
  4. handlesValueToNull should pass
  5. ignoresCaseOnlyChange should pass
  6. handlesMixedBulkOfTwoHundred should pass

Sign in to open this drill