How to get all the fields in a Field Set in Salesforce?

How to get all the fields in a Field Set in Salesforce?

Sample Field Set:




Sample Code:


  1. for ( Schema.FieldSetMember f :  SObjectType.Employee__c.FieldSets.Test.getFields() ) {  
  2.   
  3.     system.debug( f.getFieldPath() );  
  4.       
  5. }  



Here Employee__c is a Custom Object and Test is the field set name.


Output:



Leave a Reply