+ Start a Discussion

how to get description of sobject or field from apex

hello averybody.


i need someone say me how i can get the description to sobject or field from apex.

there is Schema.DescribeSObjectResult and Schema.DescribeFieldResult but they dont give a method as getDescription().

my best regard!  i hope that someone help me with that ! 


Try something like this:


public List<String> SList {
get {
if (SList == null) {

SList = new List<String>();
Schema.DescribeFieldResult field = Object.customfield__c.getDescribe();
for (Schema.PicklistEntry f : field.getPicklistValues())
return SList;


getPicklistValues : Returns a list of PicklistEntry objects. A runtime error is returned if the field is not a picklist.


and i need the description of field... not the possible values