we are working on a migration from salesforce to salesforce. We have bought one new production instance.

We want to migrate selected objects and their trigger and trigger dependent classes and the dependent classes of the dependent classes to the new production.

Is there any easy way to do this? I have started to note down the components and feeling really tired taking out the dependent classes of the trigger for an particular sobject, because I find n number of dependent classes for each dependent classes of the trigger.


You have not specified if you want this programmatically, so my guess is that you can get all dependencies with change sets.

Create a change set, and then add your trigger on it. Click on "View/Add dependencies" and Salesforce will list absolutely everything that your trigger depends on. It will show more than just classes though, so if you have lots of metadata this can take a while for you to look and process (since it can and will list all kind of metadata too).

  • Good Solution +1@Renato Oliveira – user50036 Dec 26 '17 at 13:44

One programmatic way to do this is to use the Tooling API's SymbolTable. This complex Type includes the externalReferences.

The externalReferences will detail any dependencies that the ApexClass or Trigger has on other code. You can use this to build up a complete dependency graph for your code.

There is an example of doing something like this in Spring Cleaning Apex Code with the Tooling API by Andy Fawcett.


Add a Google Extension Salesforce advanced Code searcher to your Chrome and you can enter your peace of code or Trigger Name or Class Name or Page Name. then you will get all the classes,pages and vf components.

enter image description here

I hope This will Help you..


As you are doing migration from One org to another so you can also try Unmanaged package. Using them you can move your component from org to another without any direct connection. Also just add the classes and it automatically add the dependent components so you don't need to worry about that as well.

And you can install this package in n number of orgs without any issue because Changeset only works on connected orgs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.