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
MrutyunjayMrutyunjay 

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.

 


 

Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

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.