Send an Email using Apex Trigger?

Table of Contents

Introduction to Apex Scenario

Develop an Apex Trigger to send the email to the Account owner when the Account is Created within Salesforce and Account does not have the phone and industry field populated.

Also, create a task under the account with the following information

  • Subject – The phone and Industry of the Account are Blank
  • Description – The phone and Industry of the Account are Blank
  • Priority – High
  • Status – Not Started
  • What Id – Related Account Id
  • OwnerId – Related Account Owner

Email Template

Dear <Account Owner>

A new account <account name> has been created in Salesforce. The account is missing some important information Phone & Industry.

Please try to collect this information and update the account ASAP.

Thanks & Regards,
<Company Name>

Questions to be asked

  • Which Object?
    • Account
  • Event?
    • after insert
  • Requirement?
    • Send an Email & Create a Task

Hands-On

Email Utility Class


					
				

Handler Class


					
				

Watch Complete Video

Resources

Amit Singh
Amit Singh

Amit Singh aka @sfdcpanther/pantherschools, a Salesforce Technical Architect, Consultant with over 8+ years of experience in Salesforce technology. 21x Certified. Blogger, Speaker, and Instructor. DevSecOps Champion

Articles: 299

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from Panther Schools

Subscribe now to keep reading and get access to the full archive.

Continue reading