I created a trigger to associate a custom object to the account via an Opportunity record. However, my initial loop seems to fail to run. Can anyone spot what I'm missing?
trigger associatePMRtoMode on PMR__c (before insert, before update) {
Set<ID> AccountIds = new Set<ID>();
Map<ID,ID> ACC_PMR = new Map<ID,ID>();
for (PMR__c PMR :Trigger.new){
AccountIds.add(PMR.Opportunity__r.AccountId);
ACC_PMR.put(PMR.Opportunity__r.AccountId, PMR.Id);
}
System.debug('AccountIds = ' + AccountIds);
System.debug('ACC_PMR = ' + ACC_PMR);
}