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
PatrickForgetPatrickForget 

Test a field before displaying it in VF email template

Hi,

 

Here is a portion of my VisualForce email template:

 

<tr>

           <td><th align="right">Ship to Address</th></td>

           <td align="left">{!relatedTo.GS_Address__r.Address1__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.Address2__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.Address3__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.Address4__c}</td>

       </tr>

<tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.Attn__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.City__c},{!relatedTo.GS_Address__r.ST_PROV__c}</td>

       </tr>

       <tr>

           <td><th align="right"></th></td>

           <td align="left">{!relatedTo.GS_Address__r.PostalCode__c}</td>

       </tr> 

 

I want to do the <tr> and <td> for Address2,3 and 4 only if those field have a value. I don't want empty lines between Address1 and City.

 

So, how can I test the value before displaying the field?

 

Thanks

 

Patrick

 

Best Answer chosen by Admin (Salesforce Developers) 
AvromAvrom
Wrap the TRs in an <apex:outputPanel rendered="{!!ISBLANK(relatedTo.GS_Address__r.PostalCode_

_c)" > (for example). This will display only if the referenced field isn't blank.

All Answers

AvromAvrom
Wrap the TRs in an <apex:outputPanel rendered="{!!ISBLANK(relatedTo.GS_Address__r.PostalCode_

_c)" > (for example). This will display only if the referenced field isn't blank.

This was selected as the best answer
PatrickForgetPatrickForget

Working,

 

Thank you

 

Patrick