I have trigger after insert and after update
if(trigger.isinsert){
Forecastcheckemail fr=new Forecastcheckemail(trigger.newmap,null);
fr.SendEmail();
}
If(trigger.Isupdate)
{
Forecastcheckemail fr=new Forecastcheckemail(trigger.newmap,trigger.oldmap);
fr.SendEmail();
}
Apex Class:
I want newOppMap in sendEmail() Method as well.
But i am getting error in the line Opportunity opp = newOppMap.get(id);…..Please suggest
Best Answer
You can simply pass the new map in
fr.SendEmail();
methodand your method will be
Or Another way use a private map in the controller to store the new map and old map and when you controller constructor called. Just assign the old and new map to private variables and use those variables in wherever you want