function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WizradWizrad 

Iterate Over Field Sets & Field Set Labels

Hey all,

 

I would like to iterate over all field sets for an object and get the label for the field sets.  For example:

 

<apex:repeat value="{!$ObjectType.Account.FieldSets}" var="currFS">
     <apex:pageBlockSectionItem value="{!currFS.label}">
         <apex:repeat value="{!currFS}" var="currentField">
               <apex:inputField value="{!Account[currentField]}" />
         </apex:repeat>
     </apex:pageBlockSectionItem>
</apex:repeat>

Seems like I can't do this and would just like to get confirmation.

 

Thanks! 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Cory CowgillCory Cowgill

According to the Official Force.com Blog post, there is no way to access the Metadata about a Field Set currently, and I believe Label is part of the metadata for the Field Sets. Checkout the authors comment from February 3, 2011 about lack of Metadata API in Spring 11 for Field Sets. Maybe Winter 11? :)

 

http://blog.sforce.com/sforce/2011/02/using-field-sets-in-spring-11.html

 

 

All Answers

Cory CowgillCory Cowgill

According to the Official Force.com Blog post, there is no way to access the Metadata about a Field Set currently, and I believe Label is part of the metadata for the Field Sets. Checkout the authors comment from February 3, 2011 about lack of Metadata API in Spring 11 for Field Sets. Maybe Winter 11? :)

 

http://blog.sforce.com/sforce/2011/02/using-field-sets-in-spring-11.html

 

 

This was selected as the best answer
WizradWizrad

Thanks for the quick response Cory.

Cory CowgillCory Cowgill

No problem dude. :)

 

Field Sets are pretty convienent through

 

I can definetly see why you'd want to show the Label in some cases though. For example, debug purposes.

 

And even in more Dynamic pages it may be beneficial to display the Label.

 

For example, show this Field Set A under condition X, show Field Set B under condition Y.