How to add conditional logic IF THEN SF HTML email templates?
I'm struggling with adding IF, THEN condition to my HTML Classic Email template and hoping someone can help.
I am trying to say if the Cohort Owner's name is 'X', then post the X link, if the Cohort Owner's name is 'Y', then post the Y link and if the Cohort Owner's name is 'Z' then paste the Z link.
This is the statement I am using in SF that is not outputting what I'd like
{!IF({!Cohorts__c.OwnerFirstName} = "Bob", "Boblink", " ")}
{!IF({!Cohorts__c.OwnerFirstName} = "Tim", "Timlink", " ")}
{!IF({!Cohorts__c.OwnerFirstName} = "Anna", "Annalink", " ")}
This is the output it gives me when I send an email.
= "Bob", "Boblink", " ")} = "Tim", "Timlink", " ")} = "Anna", "Annalink", " ")}
I'd like the output to be dependent on Cohort Owner and have the output as, i.e Here is.. Annalink (if Cohort Owner is Anna)
Any suggestions?
To add conditional logic IF THEN SF HTML email templates - Merge fields start with {! and end with }. You do not use {! or } within the merge field. In addition, you can use a CASE statement, which is easier to read.
{!CASE(Cohorts__c.OwnerFirstName,
"Bob", "Boblink",
"Tim", "Timlink",
"Anna", "Annalink",
"")}
Or, if you prefer the IF statements, you can nest them together:
{!IF(Cohorts__c.OwnerFirstName = "Bob", "Boblink",
IF(Cohorts__c.OwnerFirstName = "Tim", "Timlink",
IF(Cohorts__c.OwnerFirstName = "Anna", "Annalink", " ")))}