You need to sign in to do that
Don't have an account?
Can we find al custom fields
We have a requirement where we need to show all the custom field on a visualforce page , now what exactly is the issue that I do not know what all are the custom fields in that particular object. This is something like creating a product and giving it to the user, now whenever that user uses the functionality of this product through some button a pop appears where he has the ability to select standard and custom filed of that object. While developing this product we cannot hardcode anything. Therefore I was looking for any help so that I can show all the custom field of that particular object on my visual force page. Any help is highly appreciated.
Hey charles,
As far i understood ur problem u dont wana harcode the display of ur all custom fields on VF page.U just want it to be dynamic,either a new field is added or removed ur VF must display as per that....If this is the case u can use describe call on that object and get a MAP of all the custom fields including standard and custom as well.
Map<String,Schema.SObjectType> Schemaap = Schema.getGlobalDescribe();
transient Schema.DescribeSobjectResult arbdsr = Schemaap.get('object name').getDescribe();
Map<String,Schema.SobjectField> fieldMap = arbdsr.fields.getMap();
It will return a map with all the fields...
If it helped kindly mark it as a solution..thanks
All Answers
Hey charles,
As far i understood ur problem u dont wana harcode the display of ur all custom fields on VF page.U just want it to be dynamic,either a new field is added or removed ur VF must display as per that....If this is the case u can use describe call on that object and get a MAP of all the custom fields including standard and custom as well.
Map<String,Schema.SObjectType> Schemaap = Schema.getGlobalDescribe();
transient Schema.DescribeSobjectResult arbdsr = Schemaap.get('object name').getDescribe();
Map<String,Schema.SobjectField> fieldMap = arbdsr.fields.getMap();
It will return a map with all the fields...
If it helped kindly mark it as a solution..thanks
Hope its useful for him.