I have a Vf page where I am displaying all the objects from the current environment. I am displaying it in a selectList. I need to get all the field set which are there on the object which is been selected dynamically. Is it possible to get it there on Vf page. Please help me out to get the solution over this issue.

  • Here I ma able to get all the fields set related to the object I select but not able to get the label of the field set.
    – Anu
    Sep 9, 2014 at 8:58
  • Can you post the code you've written so far? Sep 9, 2014 at 9:45
  • i want to check you code, then sure i will help you. Mar 5, 2015 at 12:27

1 Answer 1


You can display a list on page which holds the names of the field sets when sobject is selected dynamically on page.

List<String> listOfFieldSetApiNames = new List<String>();
String strObjectApiName = 'Account';
Schema.SObjectType sObjType = Schema.getGlobalDescribe().get(strObjectApiName);
if( sObjType != NULL ) {
    Map<String, Schema.FieldSet> fieldSetNameToItsRecord = sObjType.getDescribe().fieldsets.getMap();
    listOfFieldSetApiNames.addAll( fieldSetNameToItsRecord.keySet() );

"strObjectApiName" this instance will be referred on page to hold the valid sobject api name and "listOfFieldSetApiNames" this will display the respective field sets.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .