October 21, 2014

Field Sets in Salesforce

Description:
  • A field set is a grouping of fields. Field sets can be referenced onVisualforce pages dynamically.
  •  If the page is added to a managed package, administrators can add, remove, or reorder fields in a field set to modify the fields presented on the Visualforce page without modifying any code.
  • We can use dynamic bindings to display field sets on our Visualforce pages.
  • Fieldset is very useful when we are working with managed package.
  • Field sets are available for visualforce pages on API version of 21.0 or above. You can have up to 50 field sets referenced on a single page.

Example:

Step 1: Create Field set in Opportunity Object.

Setup->Customize->Opportunity->Field Sets



Step 2: Drag and Drop the fields required for the Field Set


Step 3:Create records in opportunity Object


Step 4: Create Visual Force Page

https://c.ap1.visual.force.com/apex/FieldSetExample

Visual Force Name: FieldSetExample


Step 5: Write the Controller for the VisualForce Page

Apex Class: OpportunityFieldSetController


Step 6: Output


Interview Questions:
  • Explain Field Sets in Salesforce?
  • Can Field Sets used in both Standard and Custom objects? 

No comments:

Post a Comment