2

I want to know the current state of a list view( how it is sorted). Is there is any way we can know in apex how a particular list is currently sorted?

Suppose if a list view is sorted in ascending order of last name.Is there is anyway in apex we can know the same?

1
  • On default salesforce pages or visualforce ? Jan 24, 2014 at 14:22

1 Answer 1

2

To my knowledge you can not (within reason) get this information. Salesforce does store this on a per user basis in the database.

If you would know you user's latest order preference, you can with apex query data with a specific ordering by using the Order By clause.

SELECT firstname,lastname,email FROM Contact ORDER BY lastname

http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_select_orderby.htm

1
  • and its only List's that can be sorted, so if you have it in a Map or Set then the order is not guaranteed :-( Jan 24, 2014 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .