Newer Version Available
MetadataComponentDependency (Pilot)
Supported SOAP Calls
query()
Supported REST HTTP Methods
GET
Fields
| Field | Details |
|---|---|
| MetadataComponentId |
|
| MetadataComponentName |
|
| MetadataComponentNamespace |
|
| MetadataComponentType |
|
| RefMetadataComponentId |
|
| RefMetadataComponentName |
|
| RefMetadataComponentNamespace |
|
| RefMetadataComponentType |
|
Usage
Use SOQL queries to list the relationships between the metadata components in your org. The query results include one row for each relationship. Each relationship is a directional dependency between two metadata components.
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), and 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.