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 email template

can any one help on this ..

HI,

I have stuck in one small issue

that is i wrote visualforce email template in it data is taken directly from database with out any sorting format . 

 

Now i want to sort it and display it , i want to sort date field.

 

kritinkritin

Prepare a list of Date and Add values one by one of the date that you are receiving from the query. Then perform sort method on the Prepared Date List. then now take a for loop using this date list and prapare another list of Records to add and match the Exact date values with for Loop values.

 

Means you need to use temprary creat a list and do the further process on the result recieved.

 

sekharasekhara

I am not using any controller . I am writing code in Visualforce Email Template itself , here how can i take list in it..

kritinkritin

you have written that you are taking data from database then if is SFDC data..then you should to use Controlller class.

sekharasekhara

Here i am posting my code 

 

 <td><apex:outputText value=" {!opp.Points_Transaction_Date__c}" style="Sort-BY:Ascending"> </apex:outputText></td> This field i have to sort can u help me ..

 

 

If u have any code can u post it may help me alot

 

<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}" style="Sort-BY:Ascending"> </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>

 

sekharasekhara

if i use controller i am unble to get id ..

 

I worte controller --> component --> Visualforce Template also but it is not working atall.