+ Start a Discussion

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:

        Corporate Event AV:
        <apex:repeat value="{!relatedTo.CORPORATE_EVENT_AV__r}" var="av" >

Please check my code and suggest any solution.