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
mhittmhitt 

VF email code

Hello!

I am new to coding, and I was wondering if I could have some help writing a custom controller for a VF email.  This is the class I created, but I'm not sure how to do the component for this class.  (I get an unknown property error)

Class
public class eVolveServiceRequestClass {
    private final List<eVolve_Service_Request__c> requests;
    
    public eVolveServiceRequestClass() {
        requests = [select Id from eVolve_Service_Request__c ];
    }
    
    public List<eVolve_Service_Request__c> geteVolveServiceRequestComp() {
        return requests;
    }
}

Component
<apex:component controller="eVolveServiceRequestClass" access="global">
	<apex:dataTable value="{!SR_Parties}" var="srp">
		<apex:column>
			<apex:facet name="header">Party Name</apex:facet>
			{!srp.Name}
		</apex:column>
	</apex:dataTable>
</apex:component>

Email
<messaging:emailTemplate subject="Pending RON eClosing for {!eVolve_Service_Request__c.GF_Number__c} " recipientType="Contact" relatedToType="eVolve_Service_Request__c">
<messaging:htmlEmailBody >
<html>
    <body>
    
        <!--Begin body of email. -->
        Your request for a {!eVolve_Service_Request__c.RecordType} has been received and is currently Pending.<br/><br/>
        The eVolve Closer assigned to your request is {!eVolve_Service_Request__c.eVolve_Closer__c}. <br/><br/>
        The next steps that will be taken, will be to begin the vetting process to determine if all signing parties meet the minimum requirements to conduct a Remote Online Notarization.<br/><br/>
       The details of your request are listed below.<br/><br/>
       <b>Signing Service Type:</b> {!eVolve_Service_Request__c.RecordType} <br/><br/>
       <b>Contact Information</b> <br/><br/>
       
       <b>Requestor Name:</b> {!eVolve_Service_Request__c.Contact_Name__c} <br/>
       <b>Requestor Phone:</b> {!eVolve_Service_Request__c.Contact_Phone__c}<br/>
       <b>Requestor E-mail:</b> {!eVolve_Service_Request__c.Contact_Email__c}<br/><br/>
       
       <b>Transaction Details</b> <br/><br/>
       
       <b>GF#:</b> {!eVolve_Service_Request__c.GF_Number__c}<br/>
       <b>Transaction Property Address:</b> {!eVolve_Service_Request__c.Transaction_Property_Address__c}<br/>
       <b>Signing Window Requested:</b> {!eVolve_Service_Request__c.Signing_Date_Requested__c} <br/>
       <b>Estimated Closing Date:</b> {!eVolve_Service_Request__c.Estimated_Closing_Date__c}<br/><br/>
       
       <b>Signing Party Information</b> <br/><br/>
       
   <apex:repeat var="sp" value="{!relatedTo.ESR_Signing_Parties__r}">
       <b>Signing Party Type:</b> {!eVolve_Service_Request__c.Signing_Party_Type__c}<br/>
       <b>Name:</b> {!sp.Name__c} <br/>
       <b>Phone:</b> {!sp.Phone__c} <br/>
       <b>Email:</b> {!sp.Email__c} <br/>
       <b>Country:</b> {!sp.Country__c} <br/>
       <b>Time Zone:</b> {!sp.Time_Zone__c} <br/><br/>
       
    </apex:repeat>
       
       <b>Service Request Notes:</b> [insert Service Request Notes] <br/><br/>
       
       If you have any questions regarding this request please contact xxxxxxxxx and reference {!eVolve_Service_Request__c.Name}.

    </body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

Thank you!
mhittmhitt
Also, the Signing Parties is in a custom object related to eVolve_Service_Request__c
mhittmhitt
I think I've made some progess, but I am still receiving the Error: Unknown property 'core.email.template.EmailTemplateComponentController.eVolve_Service_Request__c', and I'm not sure why this error is being thrown.  Please see below for most up-to-date code

Class
public class eVolveServiceRequestClass {

    public id eVolveServiceRequestId {get;set;}
    public List<ESR_Signing_Party__c> geteVolveServiceRequestComp(){
        List<ESR_Signing_Party__c> esp;
        esp = [SELECT Name__c, Phone__c, Email__c, Country__c, Time_Zone__c FROM ESR_Signing_Party__c WHERE eVolve_Service_Request__c =: eVolveServiceRequestId];
        return esp;
    }

}
Component
<apex:component controller="eVolveServiceRequestClass" access="global">
    <apex:attribute name="ESRId" type="Id" description="Id of the Service Request" assignTo="{!eVolveServiceRequestId}"/>

        <apex:repeat value="{!eVolveServiceRequestComp}" var="sp">
        <tr>
            <td>{!sp.Name__c}</td>
            <td>{!sp.Phone__c}</td>             
            <td>{!sp.Email__c}</td>             
            <td>{!sp.Country__c}</td>             
            <td>{!sp.Time_Zone__c}</td>             
        </tr>
        </apex:repeat>       

</apex:component>

VF Email Template
<messaging:emailTemplate subject="Pending RON eClosing for {!eVolve_Service_Request__c.GF_Number__c}" 
    recipientType="Contact"
    replyTo="xxxx@xxxxxxxx.com"
    relatedToType="eVolve_Service_Request__c">
<messaging:htmlEmailBody >
<html>
    <body>
    
        <!--Begin body of email. -->
        Your request for a {!eVolve_Service_Request__c.RecordType} has been received and is currently Pending. <br/><br/>
        The eVolve Closer assigned to your request is {!eVolve_Service_Request__c.eVolve_Closer__c}. <br/><br/>
        The next steps that will be taken, will be to begin the vetting process to determine if all signing parties meet the minimum requirements to conduct a Remote Online Notarization. <br/><br/>
       The details of your request are listed below. <br/><br/>
       <b>Signing Service Type:</b> {!eVolve_Service_Request__c.RecordType} <br/><br/>
       <b>Contact Information</b> <br/><br/>
       
       <b>Requestor Name:</b> {!eVolve_Service_Request__c.Contact_Name__c} <br/>
       <b>Requestor Phone:</b> {!eVolve_Service_Request__c.Contact_Phone__c} <br/>
       <b>Requestor E-mail:</b> {!eVolve_Service_Request__c.Contact_Email__c} <br/><br/>
       
       <b>Transaction Details</b> <br/><br/>
       
       <b>GF#:</b> {!eVolve_Service_Request__c.GF_Number__c} <br/>
       <b>Transaction Property Address:</b> {!eVolve_Service_Request__c.Transaction_Property_Address__c} <br/>
       <b>Signing Window Requested:</b> {!eVolve_Service_Request__c.Signing_Date_Requested__c} <br/>
       <b>Estimated Closing Date:</b> {!eVolve_Service_Request__c.Estimated_Closing_Date__c} <br/><br/>
       
       <b>Signing Party Information</b> <br/><br/>
       <apex:repeat value="{!eVolveServiceRequestComp}" var="sp">
        <tr>
            <td>{!sp.Name__c}</td>
            <td>{!sp.Phone__c}</td>             
            <td>{!sp.Email__c}</td>             
            <td>{!sp.Country__c}</td>             
            <td>{!sp.Time_Zone__c}</td>             
        </tr>
        </apex:repeat>      
       <c:eVolveServiceRequestComp ESRId="{!relatedTo.Id}" /><br/><br/>
       
       <b>Service Request Notes:</b> insert Service Request Notes <br/><br/>
       
       If you have any questions regarding this request please contact eVolve at xxx-xxx-xxxx and reference {!eVolve_Service_Request__c.Name}.

    </body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>


Thank you for the help. ☺