Untangle Your Dependencies with MetadataComponentDependency Queries (Pilot)
Who: If you want to query MetadataComponentDependency in scratch orgs, provide your Dev Hub’s org ID when you ask to join the MetadataComponentDependency pilot. If your Dev Hub is approved for the pilot, all your scratch orgs can automatically query MetadataComponentDependency. (A Dev Hub is required only if you want to use scratch orgs.)
We especially encourage our tooling partners to apply to join the MetadataComponentDependency pilot.
Why: Many orgs are cluttered with custom objects and fields that are no longer in use. Use MetadataComponentDependency queries to determine whether your obsolete components are referenced by page layouts, formulas, and so on, so you can decide whether they’re safe to delete.
Finding dependencies among components also helps you break up your metadata into packages. Working with a set of packages rather than with one monolithic org makes it easier to manage change. For example, using packages makes it easier to use a version control system and a continuous integration system.
How: Use SOQL queries to list the relationships between the metadata components in your org. The query results include one row for each relationship.