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
sekharasekhara 

Sorting technique for visualforce email template

HI,

I am trying to sort my points by Date . 

<td><apex:outputText value=" {!opp.Points_Transaction_Date__c}"> </apex:outputText></td> 

Can any help on this ....

 

 

Here i am Posting My Code,

 

 

 

<messaging:emailTemplate subject="HI Account to Points" 
recipientType="User" 
relatedToType="Account">

<messaging:htmlEmailBody >
<html>
<body>
<p>
 <font style="font-size: 13px;" color="#000000" face="Calibri"> 
Dear <b>{!relatedTo.Last_Purchaser_Name__c} </b> at <b>{!relatedTo.Name} </b><br/><br/>
Thank you for recent purchase.<br/><br/>

You now have available SimStore Points to purchase valuable educational content. <b>Select from thousands of clinically relevant scenarios, trends, handlers, and images.</b> <br/><br/>
<b>Your Institution’s Points Balance is: 
<apex:outputText value="{0, number, ###,###,###,##0.00}">    <apex:param value="{!relatedTo.Points_Balance__c}"/>
</apex:outputText>
&nbsp; &nbsp;</b>  <br/><br/>
<b>Please save this e-mail as a record of your SimStore Points balance for future orders.</b><br/> <br/>
To use your SimStore points, follow the process below:<br/><br/>
•     Log into your SimStore account at www.mysimcenter.com/store <br/><br/>
•     Add products to your cart.<br/><br/>
•     Click “checkout” to proceed to the checkout screen.<br/><br/>
•     At the payment screen, select the “Points” payment option.<br/><br/>
•     Click “Purchase” and you will have immediate access to your SimStore content.<br/><br/>

If your order exceeds your current SimStore points balance, you will be invoiced for the difference.<br/><br/>
If your order is below your current SimStore point balance, you will receive an e-mail notification of your remaining Points balance.<br/><br/>
Sincerely,<br/>
Your SimCenter Team<br/>
 </font></p>
 <table border = '1' width="100%" cellpadding="0" cellspacing="0"> 
  <tr>
<td colspan = '4'>
<Left><b> Current Saved Point  </b></Left></td>
</tr>
  <tr>
 <td>Date</td>
<td>Reason</td>
<td>Amount</td>
<td>Currency</td>
  </tr>
  <tr>
 <td><apex:outputText value=" {!relatedTo.Point_Date__c}"/> </td>
<td>{!relatedTo.Point_Reason__c}</td>
<td>{!relatedTo.Points_Amount__c}</td>
<td>{!relatedTo.Last_Purchaser_Name__c}</td>
  </tr>
  
  </table><br/><br/>
  <table border = '1' width="100%" cellpadding="0" cellspacing="0"> 
<tr>
<td colspan = '4'>
<Left><b> Transaction History </b></Left></td>
</tr>
<tr>
 <td>Date</td>  
 <td>Reason</td>
<td>Amount</td>
<td>Currency</td>
</tr>

 
<apex:repeat var="opp" value="{!relatedTo.points__r}" >
<tr>
    <td><apex:outputText value=" {!opp.Points_Transaction_Date__c}"> </apex:outputText></td>  
    <td>{!opp.Points_Transaction_Reason__c}</td>
    <td><apex:outputText value="{0, number, ###,###,###,##0.00}"><apex:param value="{!opp.Points_Transaction_Amount__c}"/></apex:outputText></td>
    <td>{!opp.Points_Transaction_Comment__c} </td>
</tr>
 </apex:repeat>
 </table>
 </body>
 </html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

 



Starz26Starz26

When you create the list in the controller, if you add the ORDER BY clause to the syntax then the records should be sorted before your page itenerates over them.

sekharasekhara

can u post controller related to email template it may help to me

AmitSahuAmitSahu

Probably you can create a controller and use it in "relatedToType"  instead of  "Account"