4

We've repeatedly tried to figure out ways to display a Pagelayout and/or FieldSet settings in our custom VF pages without having to rely on the standard controller.

For example to display a fieldset rightnow we use a VF loop:

<apex:repeat value="{!$ObjectType.Project_Task__c.FieldSets.Project_Task_Field_Set}" var="f">
   <apex:outputField value="{!currentTask[f]}" rendered="{!NOT(editMode)}"/>
   <apex:inputField value="{!currentTask[f]}" styleclass="{!f}" required="{!f.Required}" rendered="{!editMode}"/>
</apex:repeat>

The issue being that if we can't query the fields that are currently part of the installed org's preferences, than we can't save them to the record without using the standard controller which abstracts this out.

Also, we can't use an <apex:details /> tag because it automatically redirects to another page when using its standard buttons and we're working inside of a page that we don't want to redirect after saving.

Is there anyway in APEX to discover the users current fieldset for a custom sObject?

3

Have you looked at Schema.FieldSet? It looks like it would do the trick for you. The MerchandiseDetails example at the end of the page uses the Field Set without the standard controller.

| improve this answer | |
  • Looks good, I'll have a look. – jordan.baucke Aug 19 '12 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.