这个触发器是否正确?我无法部署它。
trigger AccountSurveyTrigger on Account_Survey__c (after delete, after insert, after undelete, after update) {
List<Account_Survey__c> childObjectList;
List<Account_Survey__c> oldChildObjectList;
if( Trigger.isDelete ) {
childObjectList = Trigger.old;
} else {
childObjectList = Trigger.new;
}
//Pass in the name of the child record, in this case 'Contact' and the name of the parent record, in this case 'Account';
LookupRollupHelper lh = new LookupRollupHelper( 'Account_Survey__c', 'Account');
lh.doMathQuery = true;
lh.mathQueryType = 'AVG';
//Convert the Trigger.list to a list of sObjects
if(Trigger.isUpdate) {
lh.rollupSummary((List<sObject>)childObjectList, (List<sObject>)Trigger.old);
} else {
lh.rollupSummary((List<sObject>)childObjectList, null);
}
AccountSurveyHelper.findMostRecentNPS(trigger.new);
System.debug('After finding most recent');