답변 1개
Hi ,
Please compare it with this code.
public class AccountProcessor {
@future
public static void countContacts(List<Id> accountIds) {
List<Account> accounts = [Select Id, Name from Account Where Id IN :accountIds];
// process account records to do awesome stuff
List<Contact> con = [select id from contact where AccountId in :accounts];
for(Account a : accounts){
a.Number_Of_Contacts__c=con.size();
}
}
}
https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T4M5ASAV