I want to sort related-list records on CreatedDate in ascending. But I don't want to show CreatedDate field in related-list. Any thoughts? Can I use default sorting?

  • So is it one time sort or user can sort anytime ? – Mohith Shrivastava Nov 16 '12 at 9:35
  • Afraid you're looking at a custom vf section style related list. Don't believe you can sort on a column without displaying it in the related list. – techtrekker Nov 16 '12 at 10:01
  • it is one time sort. Actually I don't want use apex. – doga Nov 16 '12 at 10:31

I don't think it's possible. Even when tweaking the layout in Eclipse IDE you'll get an error back.

Save error: The sort field: CreatedDate is not a displayed field in the related list

Can you sort by it indirectly? Maybe you have an autonumber field there?

| improve this answer | |
  • I want to sort it by CreatedDate. If I create any autonumber field then I have to display that field as well. – doga Nov 16 '12 at 10:32

You can create a custom VF page and sort a list of sObjects by the field you want it to be sorted on. Simply not show the column CreatedDate.

Sdry's comment proved me wrong (it IS possible), take a look at this aswell: http://boards.developerforce.com/t5/Apex-Code-Development/A-gift-for-you-Sorting-a-List-lt-sObject-gt/td-p/107833

| improve this answer | |
  • With a custom VF page you could always resort to client side sorting, and hiding the column you sort on. – Samuel De Rycke Nov 16 '12 at 10:48
  • Oh okay. So you'd be able to sort a list by a specific field and not show the column itself. Am I right? – krobbens Nov 16 '12 at 10:54

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.