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
Katie DeLuna 12Katie DeLuna 12 

Visualforce templates

I am attempting to update a visualforce email template based on conditional formatting. I only want the field "Training Room" to be in the email template if there is data in the Training_Room__c field. If it is null, then I do not want the training room data pulled in anywhere.

Right now, it's always pulling Training_Room__c. See below:

<apex:outputPanel rendered="{!relatedTo.Training__r.Training_Type__r.Virtual_Training_Type__c = false}">
    <b>Time:</b> {!relatedTo.Training__r.Training_Type__r.Time__c}<br/>
<apex:outputPanel rendered="{!relatedTo.Training__r.Training_Type__r.Virtual_Training_Type__c = true}">
    <b>Time:</b> {!relatedTo.Training__r.Virtual_Start_and_End_Time__c}<br/>
    <b>Training Room:</b> {!relatedTo.Training__r.Training_Room__c}<br/>
Katie DeLuna 12Katie DeLuna 12
Also, the Training Room field is a picklist value, if that matters
Hi Katie DeLuna,
You rendered based on the picklist. If the Training_Room__c is not null.
rendered = "{!relatedTo.Training__r.Training_Room__c != null}"
Use the above one in apex:page or pageblock.
Please let me know if you have any issues. If it helps please select as Solved and best answer.