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

How to make the VF page dynamically display a new filed which was added in the object

Hello Hi, there.... Today was working on VF page and the requirement was like this.. First of all i have a VF page which will display the data and the fields from on object.. Example assume there are two fields in the object, and lets assume these fields are Name, Age...Now if i run the VF page it will display name and age fields and the data stored in that object... But what i want to do is--- I want to display the new field called Address on a VF page as soon as i go and add this(address) field in the object through set up menu.. Is this possible!!!... I will be glad with any help and i would thank them advance for it:)


You can use schema classes of API to get information about schema of SObject, and can get this information at runtime,

Map<String, Schema.SObjectField> M = Schema.SObjectType.Account.fields.getMap();  // Get the all fields information of account
Set<String> fields=new Set<String>();
fields=M.keySet();                                 // This set contains all account's fields name

U can use fieldsets OR the input fields which u are using can be iterated through the loop or use apex repeater from the apex method which will give u the fields from the object