Last active
October 21, 2018 14:48
-
-
Save cynthiabellmcgillis/bdba60de68d2a72da8d44833ae6fdd1c to your computer and use it in GitHub Desktop.
Example of using <apex:repeat> to return child records in a VF email.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<messaging:emailTemplate subject="Project: [{!relatedTo.Name}] needs Jira key(s)" | |
recipientType="User" | |
replyTo="email123@industrydive.com" | |
relatedToType="AcctSeed__Project__c"> | |
<messaging:htmlEmailBody > | |
<html> | |
<body> | |
<STYLE type="text/css"> | |
TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center } | |
TD {font-size: 11px; font-face: verdana } | |
TABLE {border: solid #CCCCCC; border-width: 1} | |
TR {border: solid #CCCCCC; border-width: 1} | |
</STYLE> | |
<font face="arial" size="2"> | |
<p>Hey {!$User.FirstName},</p> | |
<p>Below are the Brand Studio product(s) related to {!relatedTo.AcctSeed__Account__r.Name}'s campaign. </p> | |
<table border="0" > | |
<tr > | |
<th>Project Task Name</th> | |
<th>Product Name</th> | |
<th>Start Date</th> | |
</tr> | |
<apex:repeat var="pt" value="{!relatedTo.AcctSeed__Project_Tasks__r}"> | |
<apex:outputPanel layout="none" rendered="{!pt.Brand_Studio_Product__c}"> | |
<tr> | |
<td> <apex:outPutText value="{!pt.Name}"/></td> | |
<td> <apex:outputtext value="{!pt.Product__r.Name}"/></td> | |
<td> <apex:outputText value="{0, date, MM-dd-yyy}"> <apex:Param value="{!pt.AcctSeed__Start_Date__c}"/> </apex:outputText> </td> | |
</tr> | |
</apex:outputPanel> | |
</apex:repeat> | |
</table> | |
<p> | |
Click on the link to access the record and comment with Jira key(s) for Brand Studio products in Chatter: | |
<apex:outputlink value="{!LEFT($Api.Partner_Server_URL_140,FIND('.com',$Api.Partner_Server_URL_140)+4)+relatedTo.Id}">{!relatedTo.Name}<br/> <br/> <br/> | |
</apex:outputlink> | |
Thanks,<br/> | |
Industry Dive Accounting | |
</p> | |
<p/> | |
<p/> | |
</font> | |
</body> | |
</html> | |
</messaging:htmlEmailBody> | |
<messaging:plainTextEmailBody > | |
Hey {!$User.FirstName}, | |
Below are the Brand Studio product(s) related to {!relatedTo.AcctSeed__Account__r.Name}'s campaign. | |
[ Project Task Name ] - [Product Name ] - [ Start Date ] | |
------------------------------------------------------------------------- | |
<apex:repeat var="pt" value="{!relatedTo.AcctSeed__Project_Tasks__r}"> | |
[ {!pt.Name} ] - [ {!pt.Product__r.Name} ] - [ {!pt.AcctSeed__Start_Date__c} ] | |
</apex:repeat> | |
Search the Project Name {!relatedTo.Name} in Salesforce to find the Project & comment in Chatter with the Jira key(s). | |
</messaging:plainTextEmailBody> | |
</messaging:emailTemplate> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This is not HTML, this is Visualforce! But I named the file extension .html because .vfp did not highlight anything and make it hard to read.