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
Alexia Ribeiro 7Alexia Ribeiro 7 

Sort alphabetically a Select Option

How to sort alphabetically a Select Option?
I see some examples but, the most close is from a github rep, but they didn't sort number also..
I need to order [0-9-A-Z]
Please, some help? I loosing my mind with this.
Suraj Tripathi 47Suraj Tripathi 47
Hi Alexia,
If you are using SOQL query then you can get sorted list by using ORDER BY Clause in a query like this -
Example -
SOQL ORDER BY Clause ASC -
SELECT name, Amount FROM opportunity ORDER BY name ASC
Here we have used the ORDER BY Clause called ASC. From the above SOQL statement name and Amount values will be retrieved from Opportunity and records will be arranged in Ascending order.
Similarly, you can use DESC for descending order.
Please mark it as the best answer, if it helps.
Thanks