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
RSomaniRSomani 

Visualforce Email Template not showing data when email send from workflow

Hi Exprets,

I have a custom object "Corporate_Event__c" and have added Lead as a lookup in this custom object, i am facing an issue when i wanted to get records from Corporate_Event__c in Visualforce Email Template then it is not showing any data of custom object fields when this email template is send from Workflow email alert.

When i check this template by clicking "Send Test and Verify Merge Fields" button then it is working properly and showing data. I have attached my email template code below.

<messaging:emailTemplate subject="Corporate Event Form" recipientType="Lead" relatedToType="CORPORATE_EVENT__c">
    <messaging:plainTextEmailBody >
        Hi, {!recipient.Name}
        
        Please fill the event details from below url:
        
        Corporate Event:
        {!relatedTo.URL__c}

        Corporate Event AV:
        <apex:repeat value="{!relatedTo.CORPORATE_EVENT_AV__r}" var="av" >
            {!av.URL__c} 
        </apex:repeat>
        
        Thanks        
    </messaging:plainTextEmailBody>
</messaging:emailTemplate>

Please check my code and suggest any solution.

Thanks