I am using Field Set in Visualforce pages to render user-defined fields.
<apex:pageBlockSection title="HARDCODED TITLE">
<apex:repeat value="{!$ObjectType.Account.fieldsets.SystemFields}"
....
</apex:repeat>
</apex:pageBlockSection>
Instead of giving the enclosing section a hard-coded title I would like to dynamically reference / display the Field Sets Label like this:
<apex:pageBlockSection title="{!$ObjectType.Account.fieldsets.SystemFields.Label}">
<apex:repeat value="{!$ObjectType.Account.fieldsets.SystemFields}"
....
</apex:repeat>
</apex:pageBlockSection>
This is not possible as the variable exposes a FieldSetMember Array. Is there any workaround (without additional Controller code) or an Idea to vote for?
Best Answer
Late answer but I just worked on my solution for this and wanted to share. There is not solution without controller code that I can find but here's one with minimal additions.
Getting a single fieldset name
To get the name of a single fieldset you can create a variable in the controller:
then in the constructor you could use:
and finally in the VF page:
Multiple fieldsets
If you are working with multiple field sets my solution has been to create a map of titles.
Then use a function you can call from the constructor.
In the page I then call the relevant map entry with the name in lowercase
Hope this helps.