I am populating a junction object on from Events and want to capture info from the Event but getting the Account from Account field pulls null. Same who the name via the Who. But if I query the Event record, the AccountId field is populated. And of course, the code compiles properly. Can someone explain how to grab this related info?
trigger TripMeetingFromMeeting on Event (after insert, after update) {
Set<id>EventId = new Set <ID>();
List <Trip_Meeting__c> TMS = new List <trip_meeting__c>();
for (Event E:trigger.new){
if (e.Business_Trip__c!=null){
TMS.add(new Trip_Meeting__c(Meeting__c =e.id, Business_trip__c=e.Business_Trip__c,
Meeting_Date__c=e.ActivityDate, Meeting_subject__c=e.Subject,
TripNameDELETE__c=e.Business_Trip__r.name,
mWhatID__c=e.Whatid,
Meeting_Company__c=e.Account.name,
Meeting_Name__c=e.Who.name)
);
}
}
system.debug('TMS!!!============================'+TMS);
Database.insert(tms, false);
}