+ Start a Discussion
Zander ZumbrunnenZander Zumbrunnen 

How do objects get added to packages?

Hi all,

I am quite new to packages and have been having some issues.

My goal is to move over a LWC and some Apex Classes over from a sandbox org to a production org that is not related to the sandbox. I did some googling and am under the impression that a package is the best way to do this since I do not think change sets can be pushed to an outside org. (If this is not the best approach, please let me know)

As I added some of the Apex classes to the package, I noticed that it was adding objects that are not directly referenced in the class. I am querying for accounts and a custom object. Now, the unwanted objects do have a lookup to the custom object that I do want, but logically I don't see why that would mean those need to be added. 

Is there a way to stop that from happening, or maybe there is an easier approach? Any help is much appreciated.

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Zander,

Are you still facing the issue. You can make the package.xml land retrive it from source org and deploy it in destination org using workbench.