I have a client that uses Salesforce to collect info via Web-to-lead. Since they want to save money on license fees, they don't use the default Lead object. Instead they have a "copy" of the Lead object called Enquiry. Under the hood, there is a function within an Apex class called LeadHandler that creates Enquiries from Leads.

It looks something like this:

public Enquiry__c createEnquiryFromLead(Lead l){        
    Enquiry__c e = new Enquiry__c ();
    e.Some_Custom_Field__c = l.Some_Custom_Field__c;

I'm not the original dev, nor am I a Salesforce dev, so I have limited experience in this space.

What I want to do is add another custom field within that function:

e.Another_Custom_Field__c = l.Another_Custom_Field__c;

Obviously, to edit the Apex class I need a developer Sandbox.

I created a developer Sandbox, and from the developer console within the Sandbox, I made my change to the LeadHandler Apex class.

I created a test submission via Web-to-lead from the website on my local machine, and everything seems to work great.

I now want to create a change set to upload my change from the Sandbox org to the Production org.

I am hesitant to do so because there are over 300 dependencies on this LeadHandler Apex class.

My question is: Do I need to add the dependencies to the change set, even if I only made my change to the dependent file and not to the dependencies themselves? In other words, am I required to add the dependencies even if the I didn't change them? Should I add them anyway? (this is a very new Sandbox and all the dependencies are already existing in the production org)

2 Answers 2


No, you're not required to add the dependencies if they already exist. Doing so is not "harmful", but will increase the length of time it takes to complete the deployment as the additional components are processed. In the interest of not wasting your own time, you should keep the deployments as small as possible.

  • So, to be clear, when adding the individual Apex class to a change set and omitting its dependencies (because the dependencies were not modified in the Sandbox), the only thing affected on the Production org, once the change set is deployed, is the individual Apex class? The dependencies won't change or be removed in Production? I just want to make sure I'm not breaking anything. As stated above, I'm not a Salesforce developer. Thanks for the help!
    – Matthew
    Commented Jul 14, 2017 at 21:14
  • @Matthew You can't "delete" or "remove" stuff with a change set, and all deployments are partial updates. Including only what you need is perfectly fine.
    – sfdcfox
    Commented Jul 14, 2017 at 22:11

Better do not add any dependency in the change set.

In the Post deployment activities you can do following things:

  1. Provide FLS to respective profiles or permission set for the field
  2. Put this field in respective page layouts (if it is needed).
  3. Add Apex class to respective profile who will going to use.

You must log in to answer this question.

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