Skip to main content
Join the Agentforce Hackathon on Nov. 18-19 to compete for a $20,000 Grand Prize. Sign up now. Terms apply.

Create Your Email Template

Learning Objectives

In this project, you’ll:

  • Create a welcome message email template for program participants.
  • Build a flow to send a templated email to all active program participants in the same program cohort.
  • Add a quick action to run your flow from the program cohort page layout.
  • Test your flow.
  • Consider how you can change this simple flow to use it for your organization.
Note

Salesforce for Nonprofits includes both integrated platform solutions and managed packages. This project provides information about Program Management Module (PMM), a managed package.

For information about platform solutions, see the Manage Programs with Nonprofit Cloud trail.

If you’re not sure which solution your organization uses, check with your Salesforce administrator.

Before You Start

Before you complete any steps in this module, make sure you complete the hands-on challenges in Set Up a Program Management Module Trial for Trailhead using the same Trailhead Playground. The work you do in the hands-on challenges here builds on the work you complete in that badge. 

Also, consider completing the following recommended content.

Automate Emails to Your Program Participants

Program Management Module (PMM) gives your organization objects and tools to manage your programs and services. It's a foundation on which you build program data and processes in Salesforce. It comes with ready-to-use reports and dashboards that you can use to make data-driven decisions to further your mission.

How can you make it even better? By building in automation to help your users.

In this project, we use Flow Builder to create a simple flow that sends a templated email to every program participant with an active program engagement in the same program cohort. The flow operates using a quick action on program cohort records, so users can send a welcome email.

Our finished flow

Let’s get started!

Make the Choice Between Email Templates and a Text Template Within Flow Builder

When building a flow that sends an email, you need to first decide how you want to build the email template. There are two primary options: Using the Email Template object or building the template within Flow Builder using a Text Template resource.

There are advantages and drawbacks to each option, which we weighed and decided to use the Email Template object in this case. This approach provides us two advantages.

  • Anyone in your organization with access to the email template record can edit and revise the template as your requirements change. Your users won’t have to edit the flow to change the template.
  • You can only save 50 versions of an activated flow. Using an email template allows you to make changes without having to save a new version of the flow, reserving your supply of flow revisions for new features or enhancements.
Note

If you’d like to see an example of using a Text Template resource to send an email with flow, check out the Build a Donor Email Flow for Nonprofit Success Pack (NPSP) project linked in Resources.

Make Program Engagement Records Available to Email Templates

Now that we know we’ll use an email template, our first task is to make sure that the objects we need are properly configured.

We first reference fields from the Program Engagement object in our template, so we check that it’s available to be related to an email template. To do this, we need to allow activities on the Program Engagement object.

  1. Click Setup () and then Setup.
  2. Click Object Manager.
  3. Find and select Program Engagement from the list.
  4. Click Edit on the Details page.

  5. In the Optional Features section, make sure that Allow Activities is selected. If you have to select the setting, click OK on the alert message to confirm your choice.
  6. Click Save.

Create Your Email Template

Now let’s create the email template. You don’t do this in setup—Email Template is an object of its own. We start from the App Launcher.

  1. Find and select Email Templates from the App Launcher ().
  2. Click New Email Template.
  3. In Email Template Name enter Program Participant Welcome (Cohort).
  4. In Related Entity Type, select Program Engagement.
  5. In Description, enter Template to welcome participants to a program and cohort. For use in flow. (Always fill in description fields with details that will help you remember how you are using something. Your future self will thank you.)
  6. In the Folder field, select Public Email Templates.
  7. In Subject, enter Welcome to the {{{pmdm__ProgramEngagement__c.pmdm__Program__c}}} program. The text in brackets is called a merge field, and it pulls information from the program engagement record for display.
  8. Enter the content of the email. You can begin typing directly into the HTML Value field and use the rich-text formatting tools. Plus, you can click Insert merge field () to find and select information from the program engagement record or details about the recipient, sender, or organization. Explore the Insert Merge Field options if you’d like, but we did all the hard work for you here. Cut and paste this information into the HTML Value field and format it how you like.
    Dear {{{pmdm__ProgramEngagement__c.pmdm__Contact__c}}},
    Welcome to the {{{pmdm__ProgramEngagement__c.pmdm__Program__c}}} program at NMH. We're happy that you'll be joining us.You are enrolled in the {{{pmdm__ProgramEngagement__c.pmdm__ProgramCohort__c}}} cohort.Expect more information about the program soon. Please reach out directly to me if you have any questions.
    Thank you,
    {{{Sender.Name}}}
    {{{Sender.Email}}}
  9. Click Save.

Set Up an Email Alert

With our template created, we now set up an email alert to use the template. Email alerts are emails generated by an automated process and sent to designated recipients. The email alert we create here will be in place for later, to connect our email template with a flow.

  1. Click Setup () and then Setup.
  2. Enter email alerts in the Quick Find box, and click Email Alerts.
  3. If you are sent to the Understanding Workflow page, click Continue.
  4. Click New Email Alert.
  5. In the Description field, enter Send Email to Program Participants (Cohort). Unique Name should populate automatically as Send_Email_to_Program_Participants_Cohort.
  6. In the Object field, select Program Engagement.
  7. To select the Email Template, click the Email Template Lookup button () and then:
    1. Click Classic and select Lightning.
    2. Click Program Participant Welcome (Cohort).
  1. In the Recipient Type fields, select Related Contact in Search.
  2. In the Recipients fields, click Related Contact: Client in Available Recipients then click Add () to move it to Selected Recipients.
  3. In the From Email Address field, leave the default, Current User’s email address, because we want all emails to come from the person who started the flow. (You can also use a CC address in an alert, like a general internal mailbox or a program assistant.)
  4. Click Save.

We’ve done all the foundational work we need. Now it’s time to get into Flow Builder.

But first, be sure to click Verify to check your work.

Resources

在 Salesforce 帮助中分享 Trailhead 反馈

我们很想听听您使用 Trailhead 的经验——您现在可以随时从 Salesforce 帮助网站访问新的反馈表单。

了解更多 继续分享反馈