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

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

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

Okay