You need to sign in to do that
Don't have an account?
DanielJimenez
Comments out of order.
Hi,
I'm creating a simple visual force email template for my case alerts. I'm using apex:repeat to loop over relatedTo.CaseComments and display them in a simple table. However the comments are out of order, for example they display in the order below...
Fri Oct 16 05:00:00 GMT 2009
Mon Oct 19 05:00:00 GMT 2009
Tue Jun 08 15:35:21 GMT 2010
Mon Oct 19 05:00:00 GMT 2009
Is there a simple solution for this? Besides using a controller? I'd think they'd be in order in the database.
Thanks in advance!
Daniel
I'm gathering that you're not writing your own controller, but just using the standard controller. If that's the case, I don't think you have any control over this. -S
All Answers
Hi,
If you are using a query to display the case comments, then try using "Order By" in the Query.
Thanks
I'm gathering that you're not writing your own controller, but just using the standard controller. If that's the case, I don't think you have any control over this. -S
I'd presume they are out of order because when using a standard query in a database (Like Oracle) there is no guarantee of the order of the records unless you specify an "order by" clause. Salesforce doesn't seems to be adding an order by to the subquery that is being done to get the Comment records. So, even though they are timestamped, you can't rely on the order.
I agree, it would be nice if they defaulted to ordering by creation date or something reasonable, but...
So, no, I don't think you can accomplish this without a controller. :-( Best, Steve.