Rendering Email Templates in Flow

Rendering Email Templates in Flow

When you work with email templates in Flow, you may hit a few limitations. If you use an email template, the standard Send Email action expects a Contact or Lead Id. However, in many use cases you don’t have a contact (or a lead) to provide for the email template. Many teams "solve" this by creating dummy contacts just to satisfy the template requirements, which is messy and confusing. On top of that, it’s not easy to preview exactly what will be sent or let a user tweak the content inside a Screen Flow before sending the email. There is no standard way of rendering email templates in Flow.

In this post, you'll find a Flow action that renders an email template. Using this action, you can generate the final subject and body from any record you want, show it to the user for review or editing, and then send the email using the rendered output. No dummy contacts, no hacks, and full control over the final email.

How to Configure the Action

1- Install the action using the installation links below.

2- Add a new action to your flow and search for "Render Email Template", this is the name of the action that you installed.

Adding the Render Email Template action

3- This action has 3 input values.

  • templateId: The ID of the email template you want to render. This input is required.
  • recordId: ID of the record you want to use to render the email template. This is important if your template contains merge fields. This input is optional.
  • whoId: ID of the Contact or Lead record you want to use to render the email template. This is important if your template contains merge fields from the Contact or Lead object. This input is optional.
Action for Rendering Email Templates in Flow

Here are the outputs of the action:

  • HTML Body (No Style): This text output is the rendered email template without any additional CSS. Use this output value if you want to use a display text component to display the rendered email template.
  • HTML Body (Original): This text output is the rendered email template. The output that you want to use when sending the email.
  • Subject: This text output is the rendered subject line.
  • Text Body: This text output is the rendered plain text body.
Output Resources of the Action

Using the Action for Rendering Email Templates in Flow

After running the action, you can use its outputs in your Flow.

For example, here is a display text component that displays the rendered email template.

When you run or debug the Flow, this screen will display the rendered email body.

Rendering Email Templates in Flow - Debug

Here is how you can send the email with the rendered email template. As you can see, instead of choosing the "Use Email Template" option, you need to choose the output of this action. This way, Recipient ID will not be mandatory.

Sending the Email

Here is an example with a plain text template. As you can see, the user can modify the subject/body and then send the email.

Render Email Template - Demo

Installation Links

Use this link to install in production or developer edition environments.

Use this link to install in sandbox environments.

Be the first to comment

Leave a Reply

Your email address will not be published.


*