Sunday, June 19, 2011

Field Sets in Salesforce


A field set is a grouping of fields. Field sets can be displayed on Visualforce pages and added to managed packages. Organizations with field sets deployed can add, remove, or rearrange fields from the field set, without altering the Visualforce page.

Example : How to use field set in salesforce.
First u have to create a field set on object and define the field you want in field set. I created a field set Named NewFieldSet.


<apex:page standardController="Lead">
 <apex:sectionHeader title="Field Set"/>
 <apex:form >
 <apex:pageBlock >
 <apex:pageblockButtons >
     <apex:commandButton value="Save" action="{!save}"/>
 </apex:pageblockButtons>
     <apex:pageBlockSection >
         <apex:repeat value="{!$ObjectType.Lead.FieldSets.NewFieldSet}" var="f">
             <apex:inputField value="{!Lead[f]}" />
         </apex:repeat>
     </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
</apex:page>



No comments:

Post a Comment