function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Cem Kolukisa 2Cem Kolukisa 2 

Custom Email Template with Conditional Output

I have an email template where I'd like to show one of the two possible HTML content.

As an example;
Content 1
<p>I am content 1</p>

Content 2
<p>I am content 2</p>

I'd like to leverage the Opportunity Name to decide which content to display. 

For example:

If Opportunity Name CONTAINS "ABC" then display <p>I am content 1</p> ELSE display <p>I am content 2</p>

As a reminder, I am working with an email template of Custom type.

Thank you!
ANUTEJANUTEJ (Salesforce Developers) 
Hi Cem,

As per my understanding you would like to have a template that could have conditional rendering of the content, if that is the case I think you can check the below implementation where in there is a new HTML template inside which there is a script tag to run the javascript tag.

>> https://developer.salesforce.com/forums/?id=906F0000000MMyQIAW

Let me know if this helps and in case if this comes in handy can you please choose this as the best answer so that it can be used by others in the future.

Thanks.