Hello Everyone in this post let’s understand how to send email using flow in salesforce. If you are not followed our previous blog post feel free to check it out. Salesforce Lightning Tutorial For Beginners.
Objectives
After reading this Blog you can able to understand how to use the ‘Send Email’ core action to send a formatted rich text email and how to use email alert to send email in salesforce using flows.
Business Use Case
Send an email to the Opportunity owner when an opportunity is Closed-Won. The email template should include Opportunity details.
There are two ways to send an email using flows.
- Send email using standard email alert.
- Send/Compose email directlty using send email action.
Send Email Using Salesforce Flow
Send/Compose email directly using send email action.
- Go to Home then search for Flows.
- Click New flow to create new flow.
- Choose, Record Triggered flow.
- Then Choose Object, Opportunity.
- Configure Trigger, when A record is updated.

- Choose entry Criteria.
- StageName Equal to Closed Won.
- StageName Is Changed {!$GlobalConstant.True}.
- Choose Optimize the Flow for:
- Actions and Related Records.
- The Click Save.



Now you are done with the entry criteria of our flow. So now let’s create an email action using flow.
- From the toolbox drag Action interaction to the screen/Canvas.
- Next in Action search for Send Email.
- Choose a label :- Send Email to Opportunity Owner.
- Api Name :- Send_Email_to_Opportunity_Owner.
- Description :- This action is to send an email to the Opportunity owner.
- In Input Values, lets create a body using new resource and make this as a dynamic.
- Hover in body, then click for new resource.
- Resource Type :- Text Template.
- API Name :- EmailTemplateBody.
- Body :- Good News!!. You woned the Opportunity you owned {!$Record.Name}.
- Please find the below details for your reference.
- Opportunity Amount : – {!$Record.Amount}.
- Opportunity Discount :- {!$Record.Amount_After_Discount__c}.
- Opportunity Account : – {!$Record.AccountId}.
- Then Click Done.
- Choose email action body as {!EmailTemplateBody}.
- Subject :- You just woned a Opportunity.
- Email Addresses (comma-separated) : –Choose Include.
- And Choose {!$Record.Owner.Email}.
- Rich-Text-Formatted Body :- Choose Include.
- And Choose {!$GlobalConstant.True}.
- Click Done.




Note: – If you do not set Rich Text formatted body to true, then you will receive an email with HTML tags.
Once you are done with the flow below method to connect and save the flow.
- Connect the flow from start to Action.
- Click Save.
- Enter Flow Label and the API Name will auto-populate.
- Click Show Advanced.
- API Version for Running the Flow: 51
- Interview Label: Rich Text – Example {!$Flow.CurrentDateTime}
- Click Save

Congratulation now we are done with our flow. Let’s take a look at it.

Send email using standard email alert
Let us take the same business use case here and achieve it using email alert using flows. To use email alert action in your flow follow the below steps.
To use email alert we should have an email template. so let’s create an email template as below.

Once created email template, let’s create an email alert and will choose the above email template in the email alert.

Once all prerequisites are completed, let’s see how to use this email alert in flow action.
- Drag action to the canvas.
- Then Choose filter by Types.
- Then in email alert choose the email alert you have created.
- Choose a label :- Send Email through email alert.
- In set input value choose Record ID: – {!$Record.Id}.
- Then click done.

Now we are done with the email alert, let’s see what our final flow looks like.

Output
Now let’s update an opportunity record and let’s see how its works.


In this post, we saw how we can send email using 2 different methods Also, see our other blog post related to lightning. If you liked this blog post feel free to share it with your friends, until then we will meet you in another flow series blog post.
Good one…!
Nice post 🤩
Thank You.