高章伟
2022-03-22 a191c8358b35f54342da53db820ede118720230a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
trigger XinEventContactPileUp on Activity_History_Daily_Report__c (after insert, after update, after delete) {
    List<String> conIds = new List<String>();
    List<Date> conDates = new List<Date>();
 
    if (Trigger.isDelete) {
        for (Activity_History_Daily_Report__c ah : Trigger.old) {
            if (ah.Date__c != null) {
                conIds.add(ah.Contact__c);
                conDates.add(ah.Date__c);
            }
        }
    } else {
        for (Activity_History_Daily_Report__c ah : Trigger.new) {
            if (ah.Date__c != null) {
                conIds.add(ah.Contact__c);
                conDates.add(ah.Date__c);
            }
        }
    }
    
    if (conIds.size() > 0) ControllerUtil.updateContactMonth(conIds, conDates);
}