1

I got a question for retrieving custom/standard object description(marked in green color in below image) using rest/object tooling/soql.

custom object description image

As per Salesforce document (https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/tooling_api_objects_entitydefinition.htm) using EntityDefination we can fetch description of an custom object by forming soql query as below

https://infa8-dev-ed.my.salesforce.com//services/data/v53.0/query/?q=Select+Label+,+Description+,+QualifiedApiName+from+EntityDefinition+LIMIT+2

When it fire it throws below error saying Description filed in not present in the EntityDefination

[{"message":"\nSelect Label , Description , QualifiedApiName from\n               ^\nERROR at Row:1:Column:16\nNo such column 'Description' on entity 'EntityDefinition'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_FIELD"}]

Could someone please help on this .

Thanks, Naveen

1 Answer 1

5

You should use Tooling Api, so the endpoint is /services/data/v53.0/tooling/query/, while you used /services/data/v53.0/query/.

/services/data/v53.0/tooling/query/?q=SELECT+Description+FROM+EntityDefinition+WHERE+DeveloperName='customtest'

Keep in mind that the DeveloperName is case sensitive, so WHERE+DeveloperName='Account' is correct, while WHERE+DeveloperName='account' returns no record.

If you need to query only description of custom object you could use CustomObject entity

/services/data/v53.0/tooling/query/?q=SELECT+Description+FROM+CustomObject+WHERE+DeveloperName='NAME_OF_THE_OBJECT'
2
  • Thanks a lot for helping. This is what exactly i was looking for. Commented Mar 10, 2022 at 8:48
  • @infasalesforcetest You're welcome. Glad it helped Commented Mar 10, 2022 at 8:49

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.