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
Tony Mann 9Tony Mann 9 

ISBLANK formula in VF Email Template

Hello,

I want to write code to populate the following ONLY when populated; 

"Date of Birth: XX/XX/XXXX" 

I am having trouble having the 'Date of Birth:' part render without and error.

My code currently has 'Date of Birth' in the template the entire time.

Code: 

<apex:outputText value="{0, date, MM-dd-yyyy}"> 
           Date of Birth:<apex:Param value="{!IF(NOT(ISBLANK(relatedTo.Date_of_Birth__c)),relatedTo.Date_of_Birth__c, '')}" />
           </apex:OutputText>


Thanks
Ayush TripathiAyush Tripathi
Hi Try the below code
 
<apex:page Controller="solveQue">
    
    <apex:outputLabel value="{!IF(NOT(ISBLANK(relatedTo.Date_of_Birth__c)),'Date of Birth:', '')}" />
    <apex:outputText value="{0, date, MM-dd-yyyy}"> 
       
        <apex:Param value="{!IF(NOT(ISBLANK(relatedTo.Date_of_Birth__c)),relatedTo.Date_of_Birth__c, '')}" />
    </apex:OutputText>
    
</apex:page>