I am having a Custom Object (Say MyCustomObj).It has fields A,B,C,D,E. I have created a Fieldset and added A,B,C fields for MyCustomObj.

By using Dynamic SOQL I got the values of all fields including fieldset and stored it in a list. That means this list has all values of A,B,C fields of MyCustomObj.

Now I want to populate those values in a Repeater in a VF Page.

How I will display?

Any help would be appreciated.

2 Answers 2


There are several examples if you google "Fieldsets in Visualforce".

Here's a nice tutorial from our own SSE guru Bob Buzzard:


 <apex:repeat value="{!$ObjectType.Account.FieldSets.General}" 
              <apex:inputField value="{!Account[field]}" />
  • 1
    Example is good. But there all fields are displayed as input field. But I want to display all fields in PageBlockTable in Page. Commented Feb 18, 2014 at 18:16
  • 2
    @Rudra_NoVoice The same principle still applies. Just put the loop within a pageBlockSection
    – Kevin P
    Commented Feb 18, 2014 at 18:24
  • 1
    Again, after a quick google search, the following example shows up: salesforce.stackexchange.com/questions/245/… Commented Feb 18, 2014 at 18:24
  • 1
    Rudra_NoVoice the example shows how to can access it. you just need to modify the code to use different components than the Inputs. Commented Feb 18, 2014 at 18:24
  • 2
    its the same concept, just different tags... and the {!Account[field]} part doesn't need to be in anything (it can be just that, with out the apex:input etc) Commented Feb 18, 2014 at 18:24

You can find some information in spec (for example how display field label in page): https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_dynamic_vf_field_sets.htm

<apex:page standardController="Contact">
<apex:pageBlock title="Fields in Proper Names">
    <apex:pageBlockTable value="{!$ObjectType.Contact.FieldSets.properNames}" var="f">
        <apex:column value="{!f}">
            <apex:facet name="header">Name</apex:facet>
        <apex:column value="{!f.Label}">
            <apex:facet name="header">Label</apex:facet>
        <apex:column value="{!f.Type}" >
            <apex:facet name="header">Data Type</apex:facet>

  • 1
    Please answer more than an URL, at minimum include the relevant parts in your answer so that your answers remains meaningful even if the external source may go offline. Commented Feb 26, 2016 at 16:47
  • 1
    @SamuelDeRycke While this is true, it's somewhat ironic considering the accepted (and popular) answer made the same error.
    – Adrian Larson
    Commented Feb 26, 2016 at 18:23

You must log in to answer this question.

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