4

I'm trying to use the New Dependency API to find usage location of Standard Fields. Due to limitations, you cannot filter by API Name and must instead use via the MetadataComponentId:

SELECT MetadataComponentName, MetadataComponentType, 
       RefMetadataComponentName, RefMetadataComponentType 
  FROM MetadataComponentDependency 
  WHERE RefMetadataComponentId = '${fieldId}'

For custom fields, you can get this ID by querying the CustomField table, but AFAIK, there is no programmatic way to get the Id's for Standard Fields.

As expected, the "pseudo text Id" (like the ones listed here) don't work.

Can the Dependency API be used for Standard Fields?

3 Answers 3

1

I queried an Apex class with standard field dependencies to see what the data looks like. I don't see any records that look like they reference standard fields, only the StandardEntity reference to the Contact/Account objects themselves :/

Dependency API query results

4

Standard fields haven't been available in the Metadata Dependency API since the pilot -

Standard fields (and entities) are not currently supported.
Vladimir Gerasimov - 10 September 2018

You can see this in the Salesforce UI as well with the "Where is this used?" button not being available to standard fields either. That functionality is driven by the same underlying mechanism as the dependency API. You could upvote the idea Expand "Where is this used" functionality to standard fields since it will require the API to support standard fields as well.

There is some additional discussion around the limitations on Standard objects and fields in another community post.

Totally get your frustration with the use case you have. Standard objects store their dependencies very differently from custom metadata. For a lot of cases, we might not even have the information about the dependencies stored, since, well, you can't for example delete a standard object.

I don't think with the re-architecture work we are doing we are going to address this right away. Our primary focus remains on custom metadata, but with this being said, I think it's important and valid use case and at some point we will at least look into solving it.

Vladimir Gerasimov - 29th September 2020

1

You could use HappySoup.io (a 100% free and community-led open source project) , which enhances the capabilities of the MetadataComponentDependency API and provides impact and dependency analysis for standard fields.

1
  • fwiw happy soup does not appear to handle user fields - was looking for dependencies on user.manager
    – gorav
    Commented Jun 20, 2023 at 13:40

You must log in to answer this question.

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