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
Snider433Snider433 

Using IF ELSE statements in Email Templates

Hi,

 

I am trying to send an email to a friend or Account using their Account Owner .I am planning to make a single email template and use IF Else statment to make the Owner name and contact appear on the template depending on thier Account Owners.I like to know the syntax for if else used in email templates

 

Any help is Appreciated.

 

Thanks...

lvivaninlvivanin
[Are you looking just for the syntax or ?]
if (place == 1) {
medal_color = 'gold';
} else if (place == 2) {
medal_color = 'silver';
} else if (place == 3) {
medal_color = 'bronze';
} else {
medal_color = null;
}
Snider433Snider433

How can I use it in the template .Below is my test template It doest work.

 

<html>

if({!Enrollment__c.AccountOwnerID__c} == '00570000001DdGU')
{
 <p>I am owner</p>
}
else
{
    <p>I am not owner</p>
}
</html>

 

 

then I got an email reply as below

 

 

 

if(00570000001DdGU == '00570000001DdGU') {

I am owner

} else {

I am not owner

}

 

lvivaninlvivanin

I don't think we can achieve this way unless we use javascript.... As a part of the solution I would try creating a custom field whose value would be updated to 'I am owner' or 'I am not owner'  based on the required condition (through trigger or workflow) and use this custom field in the e-mail template as merged field.

 

--lvivanin

 

 

Snider433Snider433
To be more clear I am using this templates for email alerts in workflows,So I have a template designed with different Images,Signatures  in html for different Account Owners but I need to use a comman template but with selective Images and Signatures depending on Account's Owner.