You need to sign in to do that
Don't have an account?
❤Code
Dynamic Apex for display dependent picklist in vf page
Hi All,
I have two picklist fields Category__c and SubCust__c(dependent on Category__c field). How to display this field values using dynamic apex.
Need help how to display as dependent picklist.
Regards
I have two picklist fields Category__c and SubCust__c(dependent on Category__c field). How to display this field values using dynamic apex.
Need help how to display as dependent picklist.
Regards
Here is a blog on this
https://gist.github.com/boxfoot/4166342
Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
You could do that just as usual by configuring the Field Dependencies in Object configuration and using inputField controls in the visual page inside a pageblocksection. Refer to the article below for more details: https://www.salesforce.com/docs/developer/pages/Content/pages_quick_start_dependent_picklists.htm
I hope it was helpful.
Regards,
Alok
I need to have multiselect hence i am using the below code -
public List<SelectOption> getDept()
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult departfield = Activity_Tracker__c.Category__c.getDescribe();
List<Schema.PicklistEntry> picklist = departfield.getPicklistValues();
for( Schema.PicklistEntry f : picklist){
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}
public List<SelectOption> getCustb()
{
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult departfield = Activity_Tracker__c.SubCust__c.getDescribe();
List<Schema.PicklistEntry> picklist = departfield.getPicklistValues();
for( Schema.PicklistEntry f : picklist){
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}
Can u please check how to make it dependent.
Regards