You need to sign in to do that
Don't have an account?
turbo2oh
how to limit number of records shown in VF email template
I'm developing a VF email template and I'm showing various related list info via the relatedTo field for an Account but want to limit the number of records shown. Is this possible?
Example code
<messaging:emailTemplate subject="Call Report" recipientType="User" relatedToType="Account">
#lots of other stuff here
<apex:outputpanel rendered="{!!ISBLANK(relatedTo.Contacts)}"> <h2>Contacts</h2> <apex:dataTable var="c" value="{!relatedTo.Contacts}" columnClasses="columnheaders"> <apex:column headerValue="Name">{!c.Name} {!c.Suffix__c}</apex:column> <apex:column headerValue="Title">{!c.title}</apex:column> <apex:column headerValue="Email">{!c.email}</apex:column> <apex:column headerValue="Phone">{!c.phone}</apex:column> </apex:dataTable> </apex:outputpanel>
Thanks!
The "rows" attribute can limit a dataTable to a limited number of rows. You can use the .size operator on a list to show how many total rows were actually present in the original list.