+ Start a Discussion
Support 3743Support 3743 

Displaying account-related partners in email template

I have a list of accounts and I want to display all the partners for one particular account in an email sent to that account. I'm using a Visual Force email template but I don't know how to fetch all the account-related partners in the email template. Can someone please help? Thank you!
Dinesh GopalakrishnanDinesh Gopalakrishnan

<messaging:emailTemplate subject="Test Mail" recipientType="Contact" relatedToType="Account">
                <th>Partner Name</th>
            <apex:repeat value="{!relatedto.Partner__c}" var="temp">

Try this one and Change the Fields as Per Your Requirement.Let me Know the Output Once you Implemented this.
Kindly Mark this as a Best Answer if it Helps You!

Dinesh Kumar Gopalakrishnan
mukesh guptamukesh gupta

you need to use soql in apex code like:
for (AccountPartner ap:[SELECT  Id, AccountToId, AccountTo.Name, Role
      FROM  AccountPartner
      WHERE  AccountFromId = :account.Id
                        LIMIT  100]) {
                         system.debug('aaa ---- '+ap);   

 passs your account id in soql and send list to visualforce page email template.

if you need any assistance please let me know

Kindly mark my solution as the best answer if it helps you.