You need to sign in to do that
Don't have an account?
SFDCFun
Problem in adding all account names in picklist
Hi SFDC Developers,
I have one VF page and it contains a one picklist.SO now i want to append all account names in this picklist.so how i can achiev this task?
Thanks & regards,
SFDC Fun...!!!
Hi,
You will have to create a custom picklist to do that. Fetch all the picklist values using describe call and then fetch all the account names. Run your logic to forrm new picklist values and store them in a list<string>. After this use <apex:selectList> to form the custom picklist and display it on your VF Page.
Cheers!
Hi,
Go through below code
Class:
=====
public with sharing class picklistcls4 {
public List<selectoption> items { get; set; }
public String selected { get; set; }
public picklistcls4(){
items=new List<selectoption>();
items.add(new selectoption('','--Select an lead--'));
List<lead> lstl= [select id,name from lead];
for(lead a:lstl){
items.add(new selectoption(a.id,a.name));
}
}
}
VF Page:
==
<apex:page controller="picklistcls4">
<apex:form >
<apex:pageBlock >
<apex:selectList value="{!selected}" size="1" onchange="getitem()">
<apex:selectOptions value="{!items}"/>
</apex:selectList>
</apex:pageblock>
</apex:form>
</apex:page>
and if you have any more questions please feel to contact me on support@groundwireconsulting.com
Thankyou very much.