January 2015
Beginner to intermediate
302 pages
6h 56m
English
Now that we know about triggers and classes, it's time to revisit our business requirement again and complete the process to synchronize the phone field on contacts with accounts. We'll start by taking our outer class shell and inserting our updateContactPhones() method from Chapter 3, More and Later, as shown:
public with sharing class accountMethods { public static void updateContactPhones( List<Account> priorVersions, List<Account> updatedVersions ){ Set<Id> modifiedAccounts_Ids = new Set<Id>(); for ( Integer i=0;i<updatedVersions.size();i++ ){ if ( updatedVersions[i].Phone != priorVersions[i].Phone ){ modifiedAccounts_Ids.add(updatedVersions[i].Id); } } if ( modifiedAccounts_Ids.size() > 0 ){ List<Contact> contactQuery ...Read now
Unlock full access