2

I want to get an overview of all custom fields I have in an org. I don't want to see them just for a single object - I want so see them all "at once" (for the whole org). Also it would be neat if I could filter them by namespace.

Can I query them via the Metadata API? If so - how?

2
  • 1
    Btw - I think I saw a colleague with this once in Excel / Power BI. But I cannot find anything for this either.
    – Semmel
    Commented Mar 5, 2019 at 15:08
  • I've used the Field Dumper app on AppExchange and it worked well enough. It doesn't display the namespace in a separate column, only in the field's API name. Commented Mar 5, 2019 at 16:11

2 Answers 2

9

You can do this in the Tooling API (e.g. Developer Console):

SELECT NamespacePrefix, DeveloperName, TableEnumOrId
FROM CustomField

In the Developer Console in Salesforce, click on the Query Editor tab, use the above query and check the "Use Tooling API" checkbox. You can add a WHERE clause if you want to specify a certain namespace, name, or object.

3
  • 1
    Nice! Add clause where to filter by object ID like: select Id, CreatedDate, DeveloperName, EntityDefinition.DeveloperName, TableEnumOrId from CustomField WHERE TableEnumOrId = '01I2o000001QV7j' Commented Jan 15, 2021 at 11:32
  • So, I can actually filter this by entity - so WHERE EntityDefinitionId = 'Opportunity' works. But it seems I cannot also get the label for that field. Is that not supported for CustomField? @ferpaxecosanxez
    – Semmel
    Commented Jun 9, 2023 at 11:42
  • 1
    @Semmel This answer just gives a basic overview of all custom fields in an org (optionally filtered by object or namespace). If you want more than basic information, you'll still have to use describeGlobal and/or describeSObjects calls, available in SOAP or REST APIs. There is a Metadata field that returns the label and other info in the Tooling API, but limits you to just one result.
    – sfdcfox
    Commented Jun 9, 2023 at 15:25
-1

I don't know about the Metadata API, but it's certainly possible using the Partner API. You'd have to do the DescribeGlobal call to get all of the objects, which includes an array of fields on each object. Then, it's just a loop within a loop to look at each field.

ORRRRRRR you could use SDDC, which already does exactly what you're looking for. You can export every last field in your Salesforce org to a spreadsheet, either into separate tabs per object OR squish it all into a single Schema tab like you asked about. And you can filter the fields by Standard/Custom/Managed, and even Read/Write status (eg, show me all Custom fields that are not read-only). Also, SDDC includes FIELD DESCRIPTIONS!!

SDDC is made by yours truly, released into the wild just this morning actually. https://aegissoftworks.com

1
  • While this post is self-promotional, the affiliation is disclosed and therefore it conforms to our spam guidelines.
    – Adrian Larson
    Commented Jan 26, 2023 at 18:36

You must log in to answer this question.

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