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
SunchaserSunchaser 

Using Fieldsets at a Form

Hi everyone,
 
I am trying to create a custom new Account/Contact (Both Account and Contacts will be created from the same page with a custom controller) .
 
The tricky part is I don't want to hardcode the form fields into the page, customer wants to add/remove fields in the future. So we want the form fields to be picked from Account and Contact Fieldsets.

 

I have been experimenting with the visualforce code for a while now, but I haven't been able to achieve getting the Fieldsets into the Form yet.
 
Is this a possible task?
   
Thanks a lot!

Best Answer chosen by Admin (Salesforce Developers) 
harsha__charsha__c

Hi Sunchaser,

 

Yes we can use fieldsets..the way for this is as followed

 

<apex:repeat value="{!$ObjectType[object_Name].FieldSets[fieldsetName]}" var="f">
	            </apex:repeat>

 Not exactly you can make use of it..!

 

 

If this helps you out, then mark it as a solution..!

All Answers

kiranmutturukiranmutturu

yes you can make use of feldsets to acheive the same ....

harsha__charsha__c

Hi Sunchaser,

 

Yes we can use fieldsets..the way for this is as followed

 

<apex:repeat value="{!$ObjectType[object_Name].FieldSets[fieldsetName]}" var="f">
	            </apex:repeat>

 Not exactly you can make use of it..!

 

 

If this helps you out, then mark it as a solution..!

This was selected as the best answer
SunchaserSunchaser

It worked.

 

Thanks Harsha.

SunchaserSunchaser

Thanks for your reply.

harsha__charsha__c

Welcome..!