You need to sign in to do that
Don't have an account?

Custom Email Template - conditional output including merge field
I am trying to include a conditional logic in my custom Email Template, which includes merge fields.
When I include the following formula in my template:
The output in my email template looks as follows:
And when I edit the Email Template again, I can see that my code had changed to the following:
Why is that?
When I include the following formula in my template:
<br />• Case #: {!IF(Case.RecordType ="Enterprise", {!Case.CaseNumber}, "not enterprise")}
The output in my email template looks as follows:
Case #: , "not enterprise")}
And when I edit the Email Template again, I can see that my code had changed to the following:
<br />• Case #: {!NullValue(IF(Case.RecordType ="Enterprise", "{!Case.CaseNumber")}, "not enterprise")}
Why is that?
- You can use both " and ' (double and simple quotes) in a formula.
- The concatenation is done with the operator &
- if the expression is enclosed with simple quotes, use double quotes inside the enclosed expression (and vice-versa)
https://help.salesforce.com/articleView?id=customize_functions_a_h.htm&language=en&type=0Given these three rules, you can write any expression as you want:
{!IF (Case.RecordType="Enterprise", Case.CaseNumber,
'<a href="https://portal.my-company.com/' & Case.CaseId18__c & '" target="_blank">' & Case.CaseNumber & "," & Case.Subject & "</a>" ) }
Best regards
Alain
All Answers
Your problem is probably solved yet but you don't need to reuse {! } in the body of a formula.
Custom (without using Lettherhead) ?
Regards
Alain
Is it well resolved? exact value "Enterprise" ? Sometimes we have to use other values for the recordtypes.
(typos)
Regards
It appears that the merge field is working properly as you've guided:
I have a follow up question - how can I pass an HTML 'href' element as an argument in the formula? I am trying the following without any luck:
- You can use both " and ' (double and simple quotes) in a formula.
- The concatenation is done with the operator &
- if the expression is enclosed with simple quotes, use double quotes inside the enclosed expression (and vice-versa)
https://help.salesforce.com/articleView?id=customize_functions_a_h.htm&language=en&type=0Given these three rules, you can write any expression as you want:
{!IF (Case.RecordType="Enterprise", Case.CaseNumber,
'<a href="https://portal.my-company.com/' & Case.CaseId18__c & '" target="_blank">' & Case.CaseNumber & "," & Case.Subject & "</a>" ) }
Best regards
Alain
Neither of the formulas below is printing any output. Drivers_License_Expiration__c is a Date field. DriversLicenseExpired__c is a formula (text) field that compares the former to TODAY() and either reads "Expired" or "Active."
What am I missing?
e.g. {!IF(ISPICKVAL(Opportunity.Sales_Channel__c,"Inbound Web"),'To continue your order login to your online account','You can call our Customer Service Team to continue your order, all you need is your reference number : '&Opportunity.Id)}
But the text isn't displaying if I use .&Opportunity.Id. Without &Opportunity.Id the text is displaying correctly.
Can any one help me out in this.
{!IF(Account.Name == 'John Doe','<a href=" ' & Account.Link & ' ">Account Record</a>','')}
The merge field is the Account.Link and you don't use the {!SomeObject.field} format that you usual copy from the field merge field search box above you just need to use dot notation.