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
Harris DHHarris DH 

Fields into Email

Hi,

I am attempting to merge some fields into an email template. Can anyone help me with the following issue:

Rough example of what the email template looks like:

(Field A) x (Field B) = (Field C)
(Field D) x (Field E) = (Field F)

The problem emerges when Field D (for example) is empty. I still have the 'x' in the email template. Is there any way of removing this? Essentially, can I work it so that if a certain field is empty I dont get the associated text?

Any help is greatly appreciated!

sfdcfoxsfdcfox
You can use formulas in Email Templates-- this is the hidden power of the system. For example:
 
Code:
{!If(And(Not(IsNull(FieldA__c)),Not(IsNull(FieldB__c))),TEXT(FieldA__c)&" x "&TEXT(FieldB__c)&" = "&Text(FieldA__c*FieldB__c),"")}

 
This formula checks for the presence of Field A and Field B, and if there are values, outputs an entire string of text, otherwise nothing.