I cannot download the FieldDefinition data using the Tooling API for all Contact fields.

I have used this query to get the Id for the Contact object:

SELECT Id FROM EntityDefinition where DeveloperName='Contact'

Which gives me an Id of 000000000000000AAA

I then use that Id in the following query:

SELECT DataType,Description,DeveloperName,DurableId,EntityDefinitionId, FROM FieldDefinition where EntityDefinitionId='000000000000000AAA'

But I get zero results returned.

I've also tried getting the Field Id via:

SELECT Id FROM CustomField WHERE TableEnumOrId = 'Contact'

This gives me 378 results, and then using that result for the IN part of the SOQL query

SELECT Id,Description,DataType FROM FieldDefinition where durableid IN

But again I get zero results.

Can anyone help please?

1 Answer 1


It's confusing based on the naming, but if you look closer at FieldDefinition, you'll see that EntityDefinitionId is:

The durable ID for the object defined in the EntityDefinition field.

In EntityDefinition, if you query DurableId instead of Id - you'll get the developer name of the object (ex. Contact)

SELECT DurableId
FROM EntityDefinition 
WHERE DeveloperName = 'Contact'

/* returns Contact for durableId */

As such, you'll want to pass the right value into your filter to get the results from FieldDefinition

SELECT DataType,DeveloperName,Description,DurableId,EntityDefinitionId 
FROM FieldDefinition 
WHERE EntityDefinitionId = 'Contact'
  • Thank you, will try this out
    – Rich
    Commented Mar 3, 2022 at 14:51
  • Thank you again, all works :)
    – Rich
    Commented Mar 4, 2022 at 9:05
  • 1
    Great - FYI, for this site, even if you don't have enough rep to vote, you can accept an answer to your question if it's the best solution to your problem. Commented Mar 4, 2022 at 13:45
  • Tagging @Rich to accept the answer
    – metasync
    Commented Mar 4, 2022 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .