Bugude
Bugude

Reputation: 311

How to find Dependent Components for a Class/Page/Trigger using API (Tooling or Metadata API)?

We are trying to automate certail processes for which we need to find the dependent components for a Class/Page/Trigger.

We understand that salesforce is providing dependent components using "Show Dependencies" button when respective components are viewed but is there a way to get these programatically?

Any details around this is much appreciated.

Thanks!

Upvotes: 3

Views: 2648

Answers (1)

Daniel Ballinger
Daniel Ballinger

Reputation: 13537

You can use the SymbolTable that is exposed via the Tooling API. In particular, look at the externalReferences field.

Contains the name, namespace, and external class, method and variable references for the Apex class or trigger. These references can be used for symbol highlighting or code navigation.

If the SymbolTable isn't available for the ApexClass you will need to force a compile first. See Trying to get SymbolTable of an Apex class and get null.

Incidentally, the Salesforce StackExchange site is a great place to ask Salesforce specific questions.

Upvotes: 2

Related Questions