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
Sunil SSunil S 

In a picklist, I want to display US, UK on the top and rest should be alphabetical order?

 In a picklist, I want to display US, UK on the top and rest should be alphabetical order? How can we achieve this?
Deepak Kumar ShyoranDeepak Kumar Shyoran
If you want this on VF page then you can put all other country name in a selectoption list and then bind that sorted list to VF page selectList component as
​ <apex:selectList value="{!country}" size="1" multiselect="false">
<apex:selectOption itemValue="US" itemLabel="US" />
<apex:selectOption itemValue="UK" itemLabel="UK" />
<apex:selectOptions value="{!items}"/>
</apex:selectList>

public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('CANADA','Canada'));
            options.add(new SelectOption('MEXICO','Mexico'));
            options.sort() ;
            return options;
}

This way you can put UK and US on top and rest others in sorted order below them.
Chandra Sekhar CH N VChandra Sekhar CH N V
Is it a standard country picklist field or custom one where you have values in it?