Skip to main content
How to use and when is it better to use fieldsets in apex classes,are there any restrictions, any sample apex classes and its related VF page code will be highly appreciated ,coz i want to visually experience the importance and need of using fieldsets in apex classes, as i am aware of creating fieldsets and using them in VF pages.
2 respuestas
  1. 1 jun 2015, 10:17
    hi TheRealist,

     I have created the below fieldset  in my dev, for any sobject we can create a fieldset, I have used contact fieldset in below example, in repeat tag general, address is name of contact fieldsets.

    pls check it.

    <apex:page standardcontroller="contact" >

    <apex:form >

     <apex:pageBlock >

       <apex:commandButton value="save"/>

       <apex:commandButton value="cancel"/>

     <apex:pageblockSection title="General">

      <apex:repeat var="field" value="{!$objecttype.contact.fieldsets.general}">

      <apex:inputfield value="{!contact[field]}"/>

      </apex:repeat>

      </apex:pageblockSection>

      <apex:pageblockSection title="Address" columns="2">

      <apex:repeat var="field" value="{!$objecttype.contact.fieldsets.address}">

      <apex:inputfield value="{!contact[field]}"/>

      </apex:repeat>

      </apex:pageblockSection>

     </apex:pageBlock>

     </apex:form>

    </apex:page> 
0/9000