You need to sign in to do that
Don't have an account?
s.mafoder
How to get Object Fields labels in a picklist
Hello ,
Suppose I have a Salesforce Object with three fields , field1__c,field2__c,field3__c.....
I want to be able in my visualforce page to have a picklist with values field1,field2,Field3..
Depending on picklist selecting i update the selected field with an inputText...
Many thanks for your Help!!
Pleaaaase Help me !!
Use this
String type='MyCustObject_c';
List<SelectOption> options = new List<SelectOption>();
Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType leadSchema = schemaMap.get(type);
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
for (String fieldName: fieldMap.keySet()) {
//It provides to get the object fields label.
String fieldLabel = fieldMap.get(fieldName).getDescribe().getLabel();
options.add(fieldLabel);
}
In options you will get the required picklist values(field labels). Display that variable in selectlist & selectoption in vf.
If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.
Thanks
Try this...