Today I would like to show you, how to generate Change Set metadata content, based on package.xml.
Let’s assume, that you have a repository with all changes that you made on the environment, but the client’s politics requires Change Sets to move content from sandbox to production. We have a problem! You have a lot of apex classes, objects, LWC components, etc. and now you need to select all of them in Change Sets UI. It can be painful, but no worries. We have a solution for it!
Step 1: Create Outbound Change Set
Before we fill our ChangeSet with metadata content, we need to create it.
Go to your sandbox, Setup > Outbound Change Sets, and create a new one.
Copy your Change Set’s name, will be needed later.
Step 2: Adjust your code and package.xml
Go to your repository, or wherever you have org’s metadata, and modify the package.xml file with the following line  and  (optional)
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <fullName>TestChangeSet</fullName> <description>Change Set Description</description> <types> <members>TestApexClass</members> <name>ApexClass</name> </types> <types> <members>testLwcComponent</members> <name>LightningComponentBundle</name> </types> <version>49.0</version> </Package>
Important! Create .zip with all changes.
Step 3: Log in to Workbench
Firstly go to Workbench and log in to the sandbox where you created ChangeSet in the first step.
Secondly, go to migration > Deploy and upload your .zip file created in step 2 and check Auto Update Package.
Finally, Click Next and Deploy.
Step 4: Enjoy your Change Set with uploaded metadata!
- Make sure that your ChangeSet doesn’t exceed approximately 5,000 components.
- Change Set’s names are not unique! Be sure that during the upload with workbench you have only one Change Set with the full name used in package.xml
- After you upload a ChangeSet, its status becomes closed, and you can’t make changes to its component
Was it helpful? Check out our other great posts here.