Retriving a fieldset of an Object

Description

Represents a field set. A field set is a grouping of fields. For example, you could have a field set that contains fields describing a user’s first name, middle name, last name, and business title. Field sets can be referenced on Visualforce 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.

Example:

Below example shows how to retrive all fieldset of Contact object.

 
Map FsMap = Schema.SObjectType.Contact.fieldSets.getMap();
Set s = FsMap.keySet();
List fieldSetList=new List();
fieldSetList.addAll(s);

fieldSetList contains the list of all fieldset of contact Object.

Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

Leave a Reply