Send Email Alert through Salesforce Workflow Rule
When user wants to send email on create/update of a record in salesforce, instead of writing custom apex code, we can use below existing flow to achieve that:
1. Go to Setup | Create | Workflows & Approvals | Workflow Rules:
2. Create New Rule:
3. Select the Object:
4. Set Evaluation Criteria: created and every time it’s edited [2ND OPTION]:
Set Rule Criteria: formula evaluates to true.
The formula to be used:
AND(
ISCHANGED(Lookup_Field__c),
NOT(ISBLANK(Lookup_Field__c))
)
5. Hit Save and Next.
6. From under Immediate Workflow Actions, click Add Workflow Action to select Email Alert:
7. Specify the Email Template:
From the Recipients section, select Related Contact (you may see after you select Field from the list above):
8. Save it.
9. Click Done.
10. Activate.