Newer Version Available

This content describes an older version of this product. View Latest

Try It Out: Build an Email Template

To build a new email template, we have to go to the Setup area.
  1. From Setup, enter Email Templates in the Quick Find box, then select Email Templates.

Here you should see a list of all the email templates that have already been defined for your organization, including several sample templates from Salesforce.

  1. Click New Template.

    We can choose to create a text, HTML, or custom email template. HTML and custom email templates are the same except that HTML templates allow you to specify a letterhead to give your email the same look and feel as other emails from the same source.

    To keep things simple, we'll stick with a plain-text email for now.

  2. Select Text, and click Next.
    Defining an Email Template The Edit Text Email Template page for a new template named "Recruiting App - New Position Alert. The merge field codes have been pasted into the Subject and text fields.

    The New Template page lets us define the email template itself. The area near the top is where we'll generate the merge field codes for the fields in the email template below it, so let's skip past it for now and start with the Folder drop-down list.

  3. In the Folder drop-down list, choose Unfiled Public Email Templates.

    The Unfiled Public Email Templates folder is a standard, public folder available in every organization. By keeping the email template in a public folder, it'll be available to other users who have permission to view and edit email templates.

  4. Select Available For Use.

    This option will make our email template available when we create our email alert action.

  5. For Email Template Name, enter Recruiting App: New Position Alert.

    To help keep your email templates organized, it's a good idea to preface any template name with the name of the app that uses it. Or, even better, you can create a public email template folder with the name of the app, such as Recruiting App Templates, and file all the relevant email templates in it.

    Tip

  6. For Encoding, accept the default of General US & Western Europe (ISO-8859-1, ISO-Latin-1).
  7. For Description, enter Send update email to all Universal Containers employees.

    Now we get to the heart of our email template—the email's subject and body text.

  8. For Subject, enter New Open Position Alert:.

    We want to put the title of the new position in the subject of our email, so we'll need to use our first merge field here, just after the colon in our subject. To get the proper code, we'll have to go back to the merge field area near the top of the page.

  9. In the Select Field Type drop-down list, choose Position Fields.

    Although there are many objects to choose from in the Select Field Type drop-down list, because we're creating an email template for a workflow rule, we're limited to the fields for the object that will be associated with that workflow—in our case, Position. That's because the workflow rule that uses this email template won't know about any records other than the position record that triggered the workflow rule. If we put in fields from another object, they'd be left blank in our email.

    Now let's grab the field we want.

  10. In the Select Field drop-down list, choose Position Title.

    In the Copy Merge Field Value text box, a merge field code appears for Position Title. We can copy and paste it to the end of our subject line so the subject now looks like: New Open Position Alert: {!Position__c.Name}. When an email is generated from this template, {!Position__c.Name} will be replaced with the relevant position title.

    Easy, right? Now let's finish the remainder of our email.

  11. In the email body, enter the following text.
  12. Click Save.

That's it for our email template. Now that it's done, we just need to create the email alert that uses our new email template.

  1. From Setup, enter Email Alerts in the Quick Find box, then select Email Alerts.
  2. Click New Email Alert.
  3. For Description, enter Email New Position Alert. Press TAB to automatically fill in the unique name.
  4. For Object, select Position. This associates the email alert with the position object.
  5. Next to the Email Template field, click the lookup icon (Lookup icon), and select Recruiting App: New Position Alert.
  6. In the Recipient Type Search field, choose Role and Subordinates.
  7. In the Available Recipients list, select Role and Subordinates: CEO and click Add.
  8. Skip the remaining fields and click Save.

    Nice job! Now we’re ready to create a new process with an email alert action.