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
Don AlbertDon Albert 

Can't get the table's description with SOQL or Rest Api

Hi,

I'm trying to get the descriptions of the tables with SOQL query or Rest Api without succes till now. 

Any idea of how to do this?
Thank you.
ANUTEJANUTEJ (Salesforce Developers) 
Hi Don,

If you are looking for a way to get description of object in apex you can try the below snippet of code
 
// Create a new account as the generic type sObject
sObject s = new Account();

// Verify that the generic sObject is an Account sObject
System.assert(s.getsObjectType() == Account.sObjectType);

// Get the sObject describe result for the Account object
Schema.DescribeSObjectResult dsr = Account.sObjectType.getDescribe();

// Get the field describe result for the Name field on the Account object
Schema.DescribeFieldResult dfr = Schema.sObjectType.Account.fields.Name;

// Verify that the field token is the token for the Name field on an Account object
System.assert(dfr.getSObjectField() == Account.Name);

// Get the field describe result from the token
dfr = dfr.getSObjectField().getDescribe();

Link to Documentation: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_describe_objects_understanding.htm

Also, you can try checking the https://trailblazer.salesforce.com/ideaView?id=08730000000gO3LAAU idea link it might help you.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.