0

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:

enter image description here

I want newOppMap in sendEmail() Method as well. But i am getting error in the line Opportunity opp = newOppMap.get(id);.....Please suggest

2
  • Please stop using the SFDC and Salesforce-crm tags - this site is Salesforce StackExchange so all questions are about Salesforce here and those tags are redundant.
    – Dave Humm
    Commented Aug 23, 2016 at 5:59
  • is it still open?
    – Ratan Paul
    Commented Aug 27, 2016 at 7:10

1 Answer 1

3

You can simply pass the new map in fr.SendEmail(); method

fr.SendEmail(Trigger.NewMap);

and your method will be

public void SendEmail(map<Id, Opportunity>){

}

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .