Untangle Your Dependencies with MetadataComponentDependency Queries (Pilot)

Use the new Tooling API object MetadataComponentDependency to view the dependency relationships between the metadata components in your org.
Where: This change applies to Lightning Experience, Salesforce Classic, and all versions of the mobile app in Professional, Enterprise, Performance, Unlimited, and Developer editions.
Note

Note

We provide MetadataComponentDependency to selected customers through a pilot program that requires agreement to specific terms and conditions. To be nominated to participate in the program, contact Salesforce. Pilot programs are subject to change, and we can’t guarantee acceptance. MetadataComponentDependency isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback and suggestions for MetadataComponentDependency in the Dependency API Pilot group in the Trailblazer Community.

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.