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
yunicfayunicfa 

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 ! 

rt3203rt3203

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())
SList.add(f.getLabel());
}
return SList;
}
set;
}

yunicfayunicfa

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