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

Getting metadata information about fields in Visualforce Pages

Is there a way to get description information for a custom object field in Visualforce? I have a need to iterate over fields of a custom object and create a layout in 3 columns, column 1 - Label , column 2 - Input field, column 3- description information for that input field.


Is this possible in Visualforce? I am trying to replicate a 3 column word document in


Refer to page 138 APEX Code Developer's Guide


Accessing All Field Describe Results for an sObject

Use the field describe result's getMap method to return a map that represents the relationship between all the field names

(keys) and the field tokens (values) for an sObject.

The following example generates a map that can be used to access a field by name:

Map<String, Schema.SObjectField> M = Schema.SObjectType.Account.fields.getMap(); 

Gino BassoGino Basso

Something like the following will give you the object fields, through which you can retrieve various properties such as Name.


Alas it doesn't appear that the field description is exposed but perhaps you could instead use the in-line help text?


public class MyCustomController { public DescribeFieldResult[] fields { get { if (fields == null) { fields = new DescribeFieldResult[0]; for (SObjectField sf : Schema.SObjectType.MyCustomObj__c.Fields.getMap().values()) { fields.add(sf.getDescribe()); } } return fields } private set; } }


So there is no way to access a field's description value programmatically in Visualforce page?
Last I checked, there seemed to be no way to access the description info for a custom field even via metadata web services. It's simply not available in any way externally.