1

Background

A couple of years back, my org (Unlimited Edition) was created and we have some customisation derived (baseline branch) from the parent company org (with the hope that the two orgs can probably be merged into one single org in the future), but as you would have thought the orgs are diverging more and more and they are now at a point where it is impossible to merge.

So what?

We have our metadata changes stored in Git repo and deploy the metadata using ant to Prod in Bamboo, and it takes about 2-3 hours each time (30 mins for metadata validation and 2.5 hours for running all the test classes). Sometimes we need to run the validation multiple time because for some reasons the validation didn't pass, and that would take a lot of time.

Now

I thought if I remove those customisation which we don't really use at all, it would improve the deployment turnaround time. So, I am trying to remove the baseline customisation by comparing the current master branch with the baseline branch. I can identify a list of apex triggers, classes (around 800+), vf pages, etc that haven't been changed and I know are not currently in use, then I go and add them in destructiveChanges.xml and deploy it into one of our sandboxes. But each time, it has dependency errors, eg. class A is used in component B, etc.

My question, is there a better way to do this?

Any help would be greatly appreciated!

1 Answer 1

3

One way to know the dependency of the component is use an unmanaged package container.

In your org find the packages from setup, and create an unmanaged package. Add the classes you want to delete ,it will automatically put all the dependency in it.

You can then extract the package.xml and components from the unmanaged package using sfdx or workbench by providing the name of the package.

The other way would be to use the metadata dependency api that's in BETA to identify dependent metadata.

4
  • 1
    If this doesn't help and the metadata truly is unused, simply remove it from the git repo and your deployment but leave it on the org - you'll get the performance improvement without having to unpick the stuff on the org at this point...
    – Phil W
    Jun 12, 2020 at 7:49
  • 1
    I am trying the suggestion by @mohith. Will update back here. Jun 12, 2020 at 15:06
  • @PhilW, actually the metadata validation itself is taking around 30 mins, so it is less of my concern but test classse run for really long. If I remove the unused apex classes from the git, they still get run since the test classes are still present in prod org, right? Jun 12, 2020 at 15:11
  • It should only require execution of tests for the code being deployed, not all tests. But that's up to you to select as part of the deployment process.
    – Phil W
    Jun 12, 2020 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .