0

Why does the Developer Console return just one record in a scratch org when I query the FieldDefinition object?

enter image description here

The header says 46 rows, but it shows only one in the data table.

1
  • Check your FLS?
    – Derek F
    Feb 24 at 13:34

1 Answer 1

4

Referring to the documentation here and testing the query together with your query multiple times. I found that, you have to remove the Id field from the query in order to fetch all the rows; which in your case the query should be:

SELECT DeveloperName,
    QualifiedApiName,
    MasterLabel
  FROM FieldDefinition
  WHERE EntityDefinitionId = 'contact'
3
  • 1
    Great finding. Any suggestion as to why ID needs to be dropped? I am guessing because there is no actual stored ID (the one in the screenshot is the ID placeholder) and that the dev console stores the results in a map by ID - so since all the records are reported with the same fake ID, only one gets kept for display.
    – Phil W
    Feb 24 at 14:13
  • Thanks @PhilW, at first I was wondering the same on why ID needs to be dropped. But, I think what you have said seem to be the case, upon querying Id for 2 different rows (with different DeveloperName), it seems yes their Id's are the same. I think that is why only one is being displayed. Many thanks!
    – prem22
    Feb 24 at 15:01
  • 1
    If you use a soql query from say workbench or your IDE, the value of the ID column for all 46 records is 000000000000000AAA. So, the Id only needs to be dropped in the DevConsole usecase
    – cropredy
    Mar 2 at 5:18

You must log in to answer this question.

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