Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(trigger.isBefore){
- if(trigger.isInsert){
- OpportunityTriggerHandler.setPartnerManagerEmail(Trigger.New);
- }
- if(trigger.isUpdate){ handler.onBeforeUpdate(); }
- //if(trigger.isDelete){ handler.onBeforeDelete(); }
- }
- public static void setPartnerManagerEmail (List<Opportunity> oppList) {
- Set<Id> partnerAccounts = new Set<Id> ();
- for (Opportunity o : oppList) {
- partnerAccounts.add(o.Partner_Account__c);
- }
- Map <Id, Account> accountMap = new Map<Id,Account>([select id, Owner.Email from Account where id in :partnerAccounts]);
- for (Opportunity o : (List<Opportunity>) oppList) {
- o.EmailPartnerAccountManager__c = accountMap.get(o.Partner_Account__c).Owner.Email;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement