Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, 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.
Tooling API Usage
In the output of a MetadataComponentDependency query, the Apex class is represented as a metadata component (the component doing the referencing, represented by MetadataComponent* field values). The custom field is represented as a referenced metadata component (represented by RefMetadataComponent* field values). Each row in the output shows a directional dependency from one metadata component (such as YourClass) to one of the metadata components that it references (such as yourField).
- Id
- The ID of this component.
- Name
- The name of this component (for example, YourClass).
- Namespace
- The namespace this component belongs to (or, if the component isn’t in a package, null).
- Type
- The type of the component (for example, ApexClass).
- MetadataComponentId: "01p000000000SOMEID"
- MetadataComponentName: "YourClass"
- MetadataComponentNamespace: null
- MetadataComponentType: "ApexClass"
- RefMetadataComponentId: "00N000000000SOMEID"
- RefMetadataComponentName: "yourField"
- RefMetadataComponentNamespace: null
- RefMetadataComponentType: "CustomField"
- MetadataComponentId: "01p00000000SOMEIDA"
- MetadataComponentName: "ClassA"
- MetadataComponentNamespace: null
- MetadataComponentType: "ApexClass"
- RefMetadataComponentId: "00N00000000SOMEIDB"
- RefMetadataComponentName: "ClassB"
- RefMetadataComponentNamespace: null
- RefMetadataComponentType: "ApexClass"
- MetadataComponentId: "01p00000000SOMEIDB"
- MetadataComponentName: "ClassB"
- MetadataComponentNamespace: null
- MetadataComponentType: "ApexClass"
- RefMetadataComponentId: "00N00000000SOMEIDA"
- RefMetadataComponentName: "ClassA"
- RefMetadataComponentNamespace: null
- RefMetadataComponentType: "ApexClass"
In all but the simplest orgs, MetadataComponentDependency queries return a huge number of rows. It can be useful to limit the scope of your requests by type, name, or ID, to help isolate dependencies on specific components.