+ Start a Discussion
krish99krish99 

Trigger For Opportunity Stage Change

HI,

 Can AnyOne help me the  trigger which fires the email on change of opportunity stages?. It has to be customizable.  For each stage one of the email  template will be associated, i have to send a email  template to the  contact to releated  opportunity.
Rahul SharmaRahul Sharma
If thats the requirement then you might want to consider workflows!

Thanks,
Rahul
krish99krish99
@Rahul I need a trigger for this requriment may i know how can i do that..??
krish99krish99
@Rahul Can you tell me how to created this task by using workflow
Sagarika RoutSagarika Rout
I think through workflow  it is not possible to achieve this requrement , as we will not able to get related contact information to whom email need to send.

If trigger is the case below stepe need to be followed

1)  create a trigger on opportunity for before update.
2) Fetch the contact details through accountId on Opportunity record.
3) In side the trigger write email send logic , that will send to respective contact's email ID



Regards
Sagarika Rout
SFDC Developer
krish99krish99
@Sagarika

  can you give me some sample code for this task