<th>Field Name</th>
        <th>Standard API Name</th>
        <apex:repeat value="{!allFields}" var="fieldBean" id="theRepeat">
                <td><input name="CheckBoxName" id="checkBoxID" type="checkbox" value="{!fieldBean.fieldAPIName }" /></td>
                <td><input id="fieldName{!fieldBean.fieldAPIName }" type="text" value="{!SUBSTITUTE(fieldBean.fieldAPIName ,'Empyramdm__','')}" disabled="true" /></td>
                <!-- <td> <apex:outputPanel id="myFields">   
                                <apex:actionRegion >  
                                   <apex:selectList value="{!selectedField}" size="1" >
                                        <apex:selectOptions value="{!ObjectFields}"/>

                    <select id="selectedField{!selectedField}">
                        <option form="{!ObjectFields}">{!ObjectFields}</option>


public List < String > getObjectFields() {
        Map < String, Schema.SObjectType > schemaMap = Schema.getGlobalDescribe();
        Schema.SObjectType ObjectSchema = schemaMap.get('Account');
        Map < String, Schema.SObjectField > fieldMap = ObjectSchema.getDescribe().fields.getMap();

        List < SelectOption > fieldNames = new List < SelectOption > ();
        fieldNames.add(new SelectOption('--None--', '--None--'));
        Schema.SObjectField field;

        for (String fieldName: fieldMap.keySet()) {
            field = fieldMap.get(fieldName);

            //field = fieldMap.get(fieldName);
            Schema.DescribeFieldResult Fig = field.getDescribe();
            Boolean iscreate = Fig.isCreateable();
            if (iscreate == true)
                fieldNames.add(new SelectOption(fieldName, fieldName));
            //fieldMap.get(fieldName).getDescribe().getLabel();//It provides to get the object fields label.
        return fieldslisy;

enter image description here

i had created a html table,in vf page,instead of showing in dropdown,it is showing in String.i want to display entire in in dropdown by spilittingcomma, thanks in advance.

iam mapping the fields of Custom object to Standard object field,if i submit button,i have to save the custom Object associated with Standard Object Field. I had created one custom object to save this maaping,Field1 is CustomField,Field2 is StandardField.on click of Submit button iam not getting Standard object field,how can i read the data in controller.thanks,need help.

1 Answer 1


Not entirely clear on what you are aiming to do...

But as you are presenting information for multiple fields, the field options needs to include those multiple types. The code to do that would look something like this:

public Map<String, List<SelectOption>> getFieldOptionsMap() {

    Map<String, List<SelectOption>> m = new Map<String, List<SelectOption>>();

    SObjectField[] fields = Account.SObjectType.getDescribe().fields.getMap().values();

    for (SObjectType f : fields) {
        List<SelectOption> options = new List<SelectOption>();
        for (PicklistEntry pe : t.getDescribe().getPicklistValues()) {
            options.add(new SelectOption(pe.getValue(), pe.getLabel()));
        m.put(String.valueOf(t), options);

    return m;

and then in the page:

<apex:repeat value="{!allFields}" var="f" id="theRepeat">
    <apex:selectList ... >
        <apex:selectOptions value="{!fieldOptionsMap[f]}"/>

The name of the field is being used to key the options data.

  • i had updated my question,with the latest code,Apologies for my mistake
    – Satya
    Commented Feb 8, 2017 at 9:33
  • @Satya Suggest you fix the formatting though.
    – Keith C
    Commented Feb 8, 2017 at 9:36
  • because of i had given not complete code,the way u suggested i already,it is not working for me.
    – Satya
    Commented Feb 8, 2017 at 9:37
  • @Satya My main point was that if the output needs to vary by row the data needs to be keyed by something from the row. I'm afraid that applying that idea (or discarding it) is up to you...
    – Keith C
    Commented Feb 8, 2017 at 9:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .