You need to sign in to do that
Don't have an account?
Can not pull junction object reords in VF Email template
Hi All,
I have a custom object named "church event" and another custom object named "church event relationship" which has master detail relation ship with "Account" and "Church Event".
My code is like this in VF Email Template.
****************************************************************************
<messaging:emailTemplate subject="Lecture Infomation Form" recipientType="User" relatedToType="Church_Event__c">
<messaging:htmlEmailBody >
<html>
<body>
<table>
<apex:repeat value="{!relatedTo.Lecturers_Sponsors__r}" var="line" >
<tr>
<td><apex:outputLabel value="{!line.Lecturer_Sponsor__r.Name}" rendered="{!IF(line.Relationship_Type__c=='Lecturer',false,true)}"/></td>
<td><apex:outputLabel value="{!line.Lecturer_Sponsor__r.BillingCountry}" rendered="{!IF(line.Relationship_Type__c=='Lecturer',false,true)}"/></td>
<td><apex:outputLabel value="{!line.Lecturer_Sponsor__r.BillingState}" rendered="{!IF(line.Relationship_Type__c=='Lecturer',false,true)}"/></td>
<td><apex:outputLabel value="{!line.Lecturer_Sponsor__r.BillingCity}" rendered="{!IF(line.Relationship_Type__c=='Lecturer',false,true)}"/></td>
<td><apex:outputLabel value="{!line.Lecturer_Sponsor__r.BillingStreet}" rendered="{!IF(line.Relationship_Type__c=='Lecturer',false,true)}"/></td>
</tr>
</apex:repeat>
</table>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
*************************************************************************
When I use this template within saleforce it works fine and I got mail perfectly.
But when I use this from Public site I got mail with blank data.
Make sure that site public access settings has the correct read access for the object and the field level security is set as visible for the fields that you are using. Also, if you have private sharing is set for these objects you need to share the record with the site guest user.