0

I am trying to build an email template that lists all the OpportunityLineItems in the email body. Can I use the <apex: relatedList> tag? That is what I am trying to do with the code below, but I am not having any success. Can anyone tell me if this is possible, and if so, what my issue is? Thanks in advance.

<messaging:emailTemplate subject="Opportunity {!relatedTo.Opportunity_Number__c} has been booked and requires Software Fulfillment" recipientType="User" relatedToType="Opportunity">
<messaging:plainTextEmailBody >
FICO Software Fulfillment Team,
Opportunity {!relatedTo.Opportunity_Number__c} has been booked and requires Software Fulfillment.

https://fico--dev1.cs30.my.salesforce.com/{!relatedTo.Id}

<apex:relatedList list="OpportunityLineItems"/>




</messaging:plainTextEmailBody>
</messaging:emailTemplate>
2

You cannot use relatedList component inside messaging. It would not really format well anyways since you are using plaintext body. Try using a repeat tag like:

 <apex:repeat value="{!relatedTo.OpportunityLineItems}" var="oli">
      <apex:outputText value="{!oli.PriceboonEntry.Product2.Name}">
      <apex:outputText value="{!oli.UnitPrice}">
      <apex:outputText value="{!oli.Quantity}">
 </apex:repeat>

You probably want to change the formatting a bit so it looks better.

| improve this answer | |

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.