Mailing to an individual and group of individual with Apex in now an easy job. While meeting the requirement I researched for the sample source code and found nice articles. All I thought of ending up writing pretty basic and fresh template of Apex code providing a brief description of how to send an email or bulk email to an individual user or group of individual user. I believe reading the Apex code provide better idea for an developer to pick up.
Below is the requirement : A workflow sends an email to Lead owner when the lead status is changed to 'Approved' and email is sent by the current user. Since the workflow calls the Trigger before and after event, the event was exceeding the SOQL Queries made.
Requireement is optimize the piece so as to reduce the SOQL Queries by bringing logic behind the workflow into the Trigger.
Workflow :
- Criteria : When Status of Lead changes to 'Approved'
- Actions Performed
- Email to Lead Owner from current context user
Code running on Trigger BeforeUpdate
Read more by Salesforce
Below is the requirement : A workflow sends an email to Lead owner when the lead status is changed to 'Approved' and email is sent by the current user. Since the workflow calls the Trigger before and after event, the event was exceeding the SOQL Queries made.
Requireement is optimize the piece so as to reduce the SOQL Queries by bringing logic behind the workflow into the Trigger.
Workflow :
- Criteria : When Status of Lead changes to 'Approved'
- Actions Performed
- Email to Lead Owner from current context user
Code running on Trigger BeforeUpdate
Read more by Salesforce
0 comments:
Post a Comment