You need to sign in to do that
Don't have an account?
ZeeShan AbbAs
Add Options to PickList Dynamically in User Standard Page
Hey,
I made a pickList in User object and want to add data dynamically but I cannot do it via controller because it is a Standard Page and I dont have access to controller as per my knowledge..
Is there is any way to add options dynamically through another controller like we can get options through Schema
public List<SelectOption> getName() { List<SelectOption> options = new List<SelectOption>(); Schema.DescribeFieldResult fieldResult = User.Organization__c.getDescribe(); List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); for( Schema.PicklistEntry f : ple) { options.add(new SelectOption(f.getLabel(), f.getValue())); } return options; }
Is there is any way to put values to that schema...??
thanks
If you are using standard controller then you can create an extension class and do the picklist creation in it.
for example supposing your visual page is for contacts.
<apex:page standardcontroller="contact" extensions="myclass">
<apex:selectList value="{!selectedvalue}" multiselect="false">
<apex:selectOptions value="{!Name}"/>
</apex:selectList><p/>
</apex:page>
Create a class which acts as an extension for this VF page.
Public class myclass
{
public string selectedvalue{get;set;} // this stores the selected value.
public myclass(ApexPages.StandardController controller) {
}
public List<SelectOption> getName()
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult = User.Organization__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}
}
if not working kindly let me know else if solved kindly mark it solved
Regards,
Big V
Thanks for your reply but there is a problem that I am using Standard Page so I think I cannot add Controller Extension to that page.. Am I..??
I f you want this to be in statndard functionality of user object, it may not be possible as the record type options are not availaable in User object to change the pick list values according to our needs.
Regards,
Big V