What is FieldSet in Salesforce : In our previous Salesforce tutorial we have learned about different administration topics, In this salesforce admin tutorial we are going to learn about FieldSet in salesforce, how can we use FieldSets in salesforce.com, how to create a field set in salesforce.

What is FieldSet in salesforce?

In Salesforce.com, FieldSet is defined as a grouping field. Where this FieldSet is used in Visualforce pages to display the group of fields in that VF page.

Adding fields, removing and reorder fields can be possible only with FieldSets only. FieldSets are used to display fields in VF pages. These are very useful in managed packages.

How can we use FieldSets in salesforce.com ?

  • FieldSets are used to display fields.
  • They are used to add, remove and reorder fields.
  • When FieldSets are used to style forms and display those logical associations between fields.
  • FieldSets are useful in managed packages

FieldSet Considerations

Fields added to a field setcan be in one of two categories:

  • If a field is marked as Available for the Field Set, it exists in the FieldSet, but the developer hasn’t presented it on the packagedVF page. Administrators can display the field after theFieldSet is deployed by moving it from the Available column to theIn the FieldSet column.
  • If a field is marked as In the FieldSet, the developer has rendered the field on the packaged VF page by default. Administrators can remove the field from the page after the FieldSet is deployed by removing it from the In the FieldSet column.

The order in which a developer lists displayed fields determines their order of appearance on a VF page.

As a package developer, keep the following best practices in mind:

  • Subscribers with installed FieldSets can add fields that your page didn’t account for. There is no way to conditionally omit some fields from a FieldSet iteration, so make sure that any field rendered through your FieldSet works for all field types.
  • We recommend that you add only non-essential fields to your FieldSet. This ensures that even if a subscriber removes all fields in the FieldSet, VF pages that use that field set still function.