function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric.Goehring.ax954Eric.Goehring.ax954 

Visualforce Email Template

Gang,

Let me know if you can help. I created a very simple Visualforce Email Template with a list of related records using the repeat function. Problem is they are out of order, they are even out of their created Id order? strange.

 

How can I get this resolved, write a controller? Can you point me in the right direction?

 

Thanks

AhmedPotAhmedPot

Related list records should are displayed based on created date. well you could write simple controller in your VF Template to sort them with any other field.

Eric.Goehring.ax954Eric.Goehring.ax954

So what might a simple controller look like?

I need to sort by the Publication Date:

<apex:repeat var="cx" value="{!relatedTo.Schedules__r}">
<tr><td width="25%">{!month(cx.Publication_Date__c)}/{!day(cx.Publication_Date__c)}/{!year(cx.Publication_Date__c)}</td><td width="25%">{!round(cx.Ad_Discount_Pct__c,0)}%</td><td width="25%">&nbsp;</td><td width="25%">&nbsp;</td></tr>
</apex:repeat>

AhmedPotAhmedPot

Check out Visualforce guide. in Visualforce mail template --> Using Custom Controllers within Visualforce Email Templates.