We have an visualforce email template which display all the Quote line items of the quote in a table format. We use apex:repeat with relatedTo.QuoteLineItems for this. What is the order in which the QuoteLineItems are retrieved? We want it based on CreatedDate but that is not the case. Is it random or is there a specific criteria?

  • Take a look at this - Visual force sort order – The Salesforce General Aug 23 '16 at 15:00
  • Use a custom component for the QuoteLineItems and then you can control sort order either explicitly in the controller itself or by using a map expression in the repeat - VF will sort based on keys in the associated controller's map. – cropredy Aug 23 '16 at 15:22
  • @TheSalesforceGeneral Thanks. In my case, its a visualforce email template so I dont think Javascript would work. – RajeshShah Aug 24 '16 at 5:42
  • @cropredy Custom component seems to be the way; I was checking if there was a way to avoid it. – RajeshShah Aug 24 '16 at 5:42
  • CustomComponent is correct solution for this but how do I close this? Should I create my own answer? – RajeshShah Aug 26 '16 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.