function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ken sfdc1Ken sfdc1 

Rollup summary for lookup relationships my custom objects but having an error

trigger CountSpeakerEvaluationsnew on Speaker_Evaluation_AEGR__c(after insert, after delete, after undelete) {

    List<id> accIdList = new List<id>();
    if(Trigger.isInsert || Trigger.isUndelete){
        For(Speaker_Evaluation_AEGR__c con1 : Trigger.new){
            accIdList.add(con1.Medical_Event_vod__c.id);
        }
    }
    if(Trigger.isDelete){
        For(Speaker_Evaluation_AEGR__c con1 : Trigger.old){
            accIdList.add(con1.Medical_Event_vod__c.id);
        }
    }
    List<Account> accUpdateList = new List<Account>();
    For(Medical_Event_vod__c acc : [SELECT  No_of_Speaker_Evaluations__c,(SELECT id FROM Speaker_Evaluations__r) FROM Medical_Event_vod__c WHERE id =: accIdList]){
        acc.No_of_Speaker_Evaluations__c = acc.Speaker_Evaluations__c.size();
        accUpdateList.add(acc);
    }
    try{
        update accUpdateList;
    }Catch(Exception e){
        System.debug('Exception :'+e.getMessage());
    }
}


Error: Compile Error: Invalid foreign key relationship: Speaker_Evaluation_AEGR__c.Medical_Event_vod__c at line 6 column 27