binxie
2024-01-18 22bd41f13147fce1df6ff35b592720c9cb387de9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
trigger XinEventContactPileUp on Activity_History_Daily_Report__c (after insert, after update, after delete) {
    
    //deloitte-zhj 20231124 本地化导入 start
    if((!Test.isRunningTest())&&System.Label.ByPassTrigger.contains(UserInfo.getUserId())){
        return;
    }
    //deloitte-zhj 20231124 本地化导入 end
    
    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);
}