Salesforce dependency analysis is the check that lists every component using a field, flow or class, so you know what breaks before you change it. Start with Where is this used? on the field page. Then query the Tooling API object MetadataComponentDependency for a fuller list.
Clientell AI, the AI Salesforce admin, maps those dependencies for you and shows what would break before any change. Start with the free Salesforce health check. The manual method follows.
How do I see where a field is used in Salesforce?
Go to Setup > Object Manager > the object > Fields & Relationships > the field. Click Where is this used?. Salesforce lists the components that reference that custom field, such as page layouts, flows, validation rules, formula fields and Apex classes. Since Summer '24, the list also covers Dynamic Forms pages, per the Salesforce Admins blog.
Each field takes under a minute. That speed is also its limit. You check one field at a time, and you cannot export the result in bulk.
How do I query dependencies with the Tooling API?
The Tooling API object MetadataComponentDependency stores one row per link between two components. The component that uses something is MetadataComponent.... Fields starting RefMetadataComponent... describe the thing it uses. You can query it from the CLI or any REST client.
First, get the field's Id from the CustomField Tooling API object:
SELECT Id, DeveloperName, TableEnumOrId
FROM CustomField
WHERE DeveloperName = 'Region'
Then list what uses it:
SELECT MetadataComponentName, MetadataComponentType
FROM MetadataComponentDependency
WHERE RefMetadataComponentId = '00N000000000001AAA'
Run it with the Salesforce CLI:
sf data query --use-tooling-api --query "SELECT MetadataComponentName, MetadataComponentType FROM MetadataComponentDependency WHERE RefMetadataComponentId = '00N000000000001AAA'"
Replace the Id with your field's Id. For example, on a field used in one layout, one validation rule and one flow, the rows come back as Layout, ValidationRule and Flow. A flow can show up more than once, because each flow version is its own component.
To list every custom field that something references, filter by type instead:
SELECT MetadataComponentName, MetadataComponentType,
RefMetadataComponentName, RefMetadataComponentType
FROM MetadataComponentDependency
WHERE RefMetadataComponentType = 'CustomField'
Any custom field missing from that result has no tracked references. That makes it a candidate for cleanup, not a verdict.
What are the limits of MetadataComponentDependency?
Salesforce lists these limits in the MetadataComponentDependency reference:
| Limit | Detail |
|---|---|
| Records per query | No more than 2,000 on the Tooling API. No more than 100,000 on Bulk API 2.0. |
| API version | Tooling API from version 43.0. Bulk API 2.0 from version 49.0. |
| Reports | Not included in Tooling API queries. Use Bulk API 2.0 for reports. |
| Query clauses | No ORDER BY, no COUNT(), no queryMore(). Some WHERE filters on component names are not allowed. |
| Status | The docs label the object Beta, for evaluation. |
Filters on RefMetadataComponentType and RefMetadataComponentId work. A filter on RefMetadataComponentName can return an error, and COUNT() is not supported. Test your own org, because behavior can change between releases.
A big org needs a narrow query per type under the 2,000 cap (Salesforce Developers), or a Bulk API 2.0 export.
What does each method miss?
Neither method sees everything. This table shows the gaps.
| What uses the field | Where is this used? | MetadataComponentDependency |
|---|---|---|
| Layouts, validation rules, formulas | Yes | Yes |
| Flows | Yes | Yes, once per version |
| Reports | Test in your org | Not on the Tooling API |
| An outside system writing through the API | No | No |
| Apex that builds a field name as text | No | No |
| A person who fills it by hand | No | No |
Two gaps matter most. Outside systems leave no trace in metadata, so an integration can write to a field every month unseen. Apex that builds a query as a string, such as 'SELECT ' + fieldName, also hides the field name from the parser. Search your code for the field's API name as plain text too.
Metadata shows what the setup references, not what people or systems do with the field. Pair it with a fill count in SOQL (Salesforce Object Query Language), for example SELECT COUNT() FROM Account WHERE Region__c <> null. Our guide to finding unused fields covers more of these queries.
How do you read the results? A worked example
Say you plan to delete Account.Region__c. Here is what each check might return, for example.
| Check | Result | What it means |
|---|---|---|
| Where is this used? | 1 layout, 1 validation rule, 2 flow versions | Remove these references first |
MetadataComponentDependency | Same 4 rows, plus 1 Apex class | The class reads the field; update it before delete |
| Report search | 3 reports group by Region | Owners must move to a new field |
| Fill count | Most Accounts still have a value | Data still flows in; find the source |
| Integration owners | Marketing sync writes it nightly | Delete would break the sync |
Verdict: not yet. Only four setup items use the field, yet it is still alive. Old flow versions count too, so delete inactive versions in Setup > Flows before you remove the field.
How do I check before I delete or change something?
- Run Where is this used? on the field.
- Run the Tooling API query for the field's Id.
- Search reports for the field's label, because the Tooling API leaves reports out.
- Search your Apex and flows for the API name as text.
- Ask the owner of each connected system if it reads or writes the field.
- Count the filled values with SOQL, to see if data still flows in.
- Hide the field from layouts and turn off field-level security.
- Wait through one business cycle, such as a month-end close.
- Delete in a sandbox first, then in production.
The expected result is a delete that breaks nothing, because no one used the hidden field during the wait. If someone complains during step 8, you found a hidden user. Turn the field back on and add them to your list.
The undo has a deadline. Per Delete a Custom Field in Salesforce Help, deleted fields and their data stay for 15 days, and you can restore them in that window. Export the data with Data Loader before you delete.
Dependency checks matter for more than fields. For flows, see how to clean up Salesforce flows. For the wider picture, read the technical debt guide.
How do I run a dependency check in Clientell AI?
The safe order is sandbox first, with rollback ready. Clientell AI reads your org in read-only mode, tests changes in a sandbox, and asks before it changes anything in production. See how Clientell AI keeps your org safe.
Try it in Clientell AI: "Show everything in my org that uses the Region field on Account, including flows, reports and layouts, and tell me what breaks if I delete it."
Start the 14-day trial, no card needed.
Common questions about Salesforce dependency analysis
What is the best Salesforce dependency analysis tool?
For one field, Where is this used? is the fastest. For a list across the org, query MetadataComponentDependency. Third-party tools and Clientell AI add reports, code search and ranking. Compare what each one reads.
Can I query dependencies for a flow or an Apex class?
Yes. Use the component's Id in the RefMetadataComponentId filter, or filter MetadataComponentType to find what a type uses. The same limits apply.
Does MetadataComponentDependency include reports?
No. Salesforce says reports are left out of Tooling API queries. Use Bulk API 2.0 to include them, or search reports by the field label.
How long can you restore a deleted custom field?
For 15 days, per Salesforce Help. After that, Salesforce erases the field and its data, so export the data first.
Is MetadataComponentDependency production ready?
The docs still label it Beta. It works for most dependency checks, but test your queries in your own org first.
Sources
Salesforce documentation
- MetadataComponentDependency (Beta), Tooling API
- CustomField, Tooling API
- Delete a Custom Field
- Jen's Top Summer '24 Release Features, Salesforce Admins
Last reviewed October 2026
Last updated: October 22, 2026



