DEV Community

Tulip Pattra B
Tulip Pattra B

Posted on • Edited on

Create email template to display multiple child records in one email. - [Salesforce]

Save hours by using a visual email template# that has been provided by Salesforce instead of creating an apex class.

Let's do it!

Here are the steps.

  • Go to Set up > Navigate to "Classic Email Templates"
  • Select "New Template", then select "Visualforce"

Alt Text

  • Input email properties.

    • Folder: Unfiled folder
    • Available For Use: TRUE **Can check it later when it's finished.
    • Email Template Name: Request for Multiple Line Items Discount.
    • Template Unique Name: Request_for_Multiple_Line_Items_Discount
    • Encoding: Unicode (UTF-8)
    • Description: I leave it blank, but if you have any information to inform other developers internally, you can type it over here. It will not display in the email body or in the subject.
    • Subject: Discount Request
  • Input the code in the email content.

Alt Text

Hoorey!! It's done.
Don't forget to test the template by following the steps below.
Alt Text
Alt Text

Note: If you want to highlight only the discount that is greater than 40%. Put something like this in style.

style="{!if(oppline.discount> 40,'color:red;font-weight: bold', 'color:black')}"/>

HTML Color Code: https://htmlcolorcodes.com/

The interesting article about colors that may help you decide which color could be applied on your email template:D

https://www.scienceofpeople.com/color-psychology/#what-color-you-should-make-your-desktop
Alt Text

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay