0

I created a Visualforce email template on case, and I want to include the list of Case Team Members in the email. How would I do that? This is what I have so far...I put the ContactID on there just to see if I could access at least something from the Case Team. It seems like a I can, but I don't know how to get a list of their names. I'm very new to this so any help will be greatly appreciated!

> <messaging:emailTemplate subject="Auction ECR Request Scheduled"
> recipientType="User" relatedToType="Case">
>     <messaging:htmlEmailBody>
    <html>
    <body>
            <table align="center">

                  <tr>
                      <td>
                          <p>The request you submitted Case# {!relatedTo.CaseNumber} on 
                              <apex:outputText value="{0,date,MM/dd/yyyy}">
                                 <apex:param value="{!relatedTo.Requested_Date__c}"/> 
                              </apex:outputText>
                              has been scheduled by AiM. The CR writers will be on site 
                              <apex:outputText value="{0,date,MM/dd/yyyy}">
                                 <apex:param value="{!relatedTo.Date_Scheduled__c}"/> 
                              </apex:outputText>.
                           </p>
                      </td>
                   </tr>

                   <tr><td></td></tr>
                   <tr><td></td></tr>
                   <tr><td></td></tr>
                   <p>
                   Contact ID: {!relatedTo.TeamMembers}
                   </p>
                   <tr><td></td></tr>
                   <tr><td></td></tr>
                   <tr><td></td></tr>

                   <tr>
                      <td>
                          <p>Vendor Notes: 
                              {!relatedTo.Vendor_Notes__c}
                           </p>
                      </td>
                   </tr>

                   <tr><td></td></tr>
                   <tr><td></td></tr>
                   <tr><td></td></tr>

                   <tr>
                      <td>
                          <p>Please contact us if you have any questions or if you need additional assistance.</p>
                      </td>
                   </tr>

                   <tr><td></td></tr>
                   <tr><td></td></tr>
                   <tr><td></td></tr>

                   <tr>
                      <td>
                          <p>Thank You,</p>
                      </td>
                   </tr>

                   <tr><td></td></tr>

                   <tr> 
                      <td>
                         <p>Support Team</p>
                      </td>   
                   </tr>

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

1

Sooo...I finally figured this out using information provided on the page below.

https://developer.salesforce.com/page/VisualForceEmailTemplates_sample

Here's the code that worked as I needed it to...

<messaging:emailTemplate subject="Auction ECR Request Scheduled" recipientType="User" relatedToType="Case">
    <messaging:htmlEmailBody >
        <html>
        <body>
                <table align="center">
                      <tr><td>Greetings - </td></tr>

                      <tr><td></td></tr>
                      <tr><td></td></tr>
                      <tr><td></td></tr>     

                      <tr>
                          <td>
                               <p>The request you submitted Case# {!relatedTo.CaseNumber} on&nbsp;
                                 <apex:outputText value="{0,date,MM/dd/yyyy}">
                                     <apex:param value="{!relatedTo.Requested_Date__c}"/> 
                                  </apex:outputText>
                                  has been scheduled by AiM. The CR writers will be on site&nbsp;
                                  <apex:outputText value="{0,date,MM/dd/yyyy}">
                                     <apex:param value="{!relatedTo.Date_Scheduled__c}"/> 
                                  </apex:outputText>.
                               </p>
                           </td>
                       </tr>

                       <tr><td></td></tr>
                       <tr><td></td></tr>
                       <tr><td></td></tr>
                     <tr>
                         <td>CR Writers: </td>
                     </tr>
                     <apex:repeat var="ct" value="{!relatedTo.TeamMembers}">
                         <tr>
                          <td>{!ct.Member.Name}</td>
                         </tr>
                     </apex:repeat>

                       <tr><td></td></tr>
                       <tr><td></td></tr>
                       <tr><td></td></tr>
                       <br></br>

                       <tr>
                          <td>Vendor Notes: </td>
                       </tr>
                       <tr>
                           <td>{!relatedTo.Vendor_Notes__c}</td>
                       </tr>

                       <tr><td></td></tr>
                       <tr><td></td></tr>
                       <tr><td></td></tr>
                       <br></br>

                       <tr>
                          <td>
                              <p>Please contact us if you have any questions or if you need additional assistance.</p>
                          </td>
                       </tr>

                       <tr><td></td></tr>
                       <tr><td></td></tr>
                       <tr><td></td></tr>

                       <tr>
                          <td>
                              <p>Thank You,</p>
                          </td>
                       </tr>
                </table>
            </body>             
        </html>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.