I am using :
trigger.oldMap.get(op.ID).Owner.Name;
and it is returning me null. Is there a way I can get both old and new opportunity owner name. Using query I am able to get only the new owner name.
Map<ID,Opportunity> allOpp1 = new Map<ID,Opportunity>([Select ID, Account.ID, Opportunity.Owner.Name, Opportunity.Owner.Email, Opportunity.Owner.FIrstName, Owner.ID from Opportunity]);
for(Opportunity op : trigger.new){
String body = 'Dear '+allOpp1.get(op.Id).Owner.FirstName+'\n Opportunity: '+op.Name+' has be moved to the new Owner '+trigger.oldMap.get(op.ID).Owner.Name;
}
Thanks in advance.