I have seen examples where people display fieldset for an sobject.

But instead of mySobject if i want to display the field set for a list of sobjects?

  • for example: <apex:page standardController="Contact"> <apex:repeat value="{!$ObjectType.Contact.FieldSets.properNames}" var="f"> <apex:outputText value="{!Contact[f]}" /><br/> </apex:repeat> </apex:page> Oct 4, 2016 at 2:56
  • Is it a list of SObjects of the same type or of different SObject types?
    – Lance Shi
    Oct 4, 2016 at 3:13

1 Answer 1


I suppose you mean by a list of SObjects of the same SObject type, say Contact. And then the code can be pretty easy.


<apex:page standardController="Contact" extensions="fieldSetExtension"> 
    <apex:repeat value="{!contactList}" var="c">
        <apex:repeat value="{!$ObjectType.Contact.FieldSets.Name_Set}" var="f"> 
            <apex:outputText value="{!c[f]}" />


public class fieldSetExtension 
    public List<Contact> contactList {get; set;}
    public fieldSetExtension(ApexPages.StandardController stdController)
        contactList = [Select Id, Name, LastName, Email, MobilePhone, Level__c From Contact];

Of course, you should be using Dynamic SOQL here, which I am too lazy to implement here. But the concept is the same.

You must log in to answer this question.

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