+ Start a Discussion
T-HanT-Han 

VF Email Template to populate fields when it is present

Scenario: I have a record with 80 fields and I would like to send an VF email template based on a certain condition.

 

Needed Solution: When I send out an email, it should only be with the fields which are popuated in the Record and not all the 80 fields.

 

Eg: In one case I may have 40 fields filled up and some 50, 60 etc,. 

 

How can this be achieved?

 

Any ideas/suggestions are highly appreciated..

Himanshu ParasharHimanshu Parashar

Hi,

You need to use rendered attributes for every field as we do in visualforce page.

 

for example

 

<apex:outputText value="{!RelatedTo.CurrencyIsoCode} {0,number,###,###,###,##0}" rendered="{!RelatedTo.field__c<>''}">