Salesforce Dependency API
The Salesforce Dependency API is the Tooling API object MetadataComponentDependency. Each row it returns is one directional dependency between two metadata components of an org — for example an Apex class referencing a custom field. Salesforce still labels it Beta, and it comes with documented query limits that shape how it can be used.
What it returns
Each record pairs a component with a component it references: MetadataComponentId, MetadataComponentName, MetadataComponentNamespace and MetadataComponentType on one side, and the matching RefMetadataComponent… fields on the other. A circular reference — two classes calling each other — appears as two rows.
Names are returned without their suffix, so a custom field appears without __c, and Salesforce advises using 18-character Ids rather than 15-character ones in queries.
How it can be queried
The object can be queried through the Tooling API from API version 43.0 and through Bulk API 2.0 from version 49.0. The Tooling API returns no more than 2,000 records in a single query and does not include reports; Bulk API 2.0 returns up to 100,000 records per query and is the documented route for dependencies involving reports.
Documented limits
Several SOQL features are not supported: ORDER BY, count(), queryMore() and OFFSET, filtering on the component name fields, LIKE on the type fields, and WHERE operators other than =, !=, AND and OR. Salesforce warns that in all but the simplest orgs these queries return a very large number of rows and should be narrowed by type, name or Id.
Salesforce also describes the Beta as a preview offered for evaluation, without a guarantee of general availability — worth knowing before building a production process on it.
How aprity helps
aprity reads an org's metadata read-only and computes a dependency graph for the whole org deterministically. On top of it, an impact analysis on a field, an object or an Apex class lists the components downstream of a change, and every documented rule links back to the component it was read from.
Related terms
- Apex trigger — Apex code that runs automatically before or after records of an object are inserted, updated, deleted or undeleted.
- Managed package and namespace prefix — A managed package is a distributable, upgradeable bundle of metadata; its namespace prefix is the identifier added to every component's API name.
- Field-level security (FLS) — The Salesforce setting that decides, per profile or permission set, whether a user can read or edit each field of an object.
Sources
Official Salesforce documentation this entry was checked against. Platform behaviour changes between releases; the linked page is the reference.