DEV Community

Tulip Pattra B
Tulip Pattra B

Posted on

Display multiple child records in one email template

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

Top comments (0)