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
SFDCFunSFDCFun 

Problem in adding all leads name in Picklist

Hi SFDC Developers,

 

i have one VF page and it contains one Picklist.so now i want to append all Lead names in this picklist.so how i can achiev this?

 

Thanks & Regards,

SFDC Fun...

John L.John L.

Go here:

 

http://www.salesforce.com/us/developer/docs/pages/salesforce_pages_developers_guide.pdf

 

Look for the section entitled "Associating a Standard List Controller with a VisualForce Page" for an example similar to what you are trying to do.

 

Alternately, you can read the section entitled "apex:selectList" in the "Standard Component Reference" section..

Chidambar ReddyChidambar Reddy
Hi,

In your page

<apex:outputLabel for="1" > Source RV  </apex:outputLabel>
            <apex:selectList id="1" size="1" value="{!selected}" >
                <apex:selectOptions value="{!LeadNames}"/>
            </apex:selectList>

//In your Controller

public string selected {get; set;}

public List<selectOption> getleadNames(){
      
        List<SelectOption> leads= new List<SelectOption>();
        leads.add(new SelectOption('','--None--'));
      
        for(lead l:[SELECT Id,Name  from Lead  ]){
            leads.add(new SelectOption(l.Id,l.Name));
        }
        leads.sort();
      
        return leads;
    }


-Thankyou
choose it as best answer if it resolved your issue. :-)