You need to sign in to do that
Don't have an account?
VF Email Template for Parent and Child Account
Hello,
I am trying to create a visualforce email template that will send a user a list of Account and Contact data. I want to include Parent and Child Accounts and all related Contacts. So far I can get the Contacts list as it relates to an Account with the below code, but this does not include the data for the Child Account if I choose the Parent.
My use case is this: if opportunity stage = Closed Won send an email to a list of users welcoming our new client. The email should include all Parent and child accounts including all related contacts.
<messaging:emailTemplate subject="New Client" recipientType="User" relatedToType="Account"> <messaging:HtmlEmailBody > Account Name : {!Relatedto.Name} <br/> Account Address: {!Relatedto.BillingStreet} <br/> Account City: {!Relatedto.Billingcity} <br/> Account State: {!Relatedto.BillingState} <br/> <apex:repeat var="cx" value="{!relatedTo.Contacts}"> Contact Name: {!cx.name}<br/> Contact Address:{!cx.mailingstreet}<br/> Contact Email:{!cx.email}<br/> </apex:repeat> <br/> </messaging:HtmlEmailBody> </messaging:emailTemplate>
Thanks
Thanks for the info gtuerk -
At this point I am still more of an intermediate admin type with no developer skills. I'll dig into the documentation regarding custom controllers and see if I can figure it out.
Thanks