Hello Folks!
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!
Let’s begin!
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 [3] and [4] (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!

Consideration!
- 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.
Resources
- https://help.salesforce.com/articleView?id=changesets.htm&type=5
- https://help.salesforce.com/articleView?id=changesets_about_outbound.htm&type=5
Hello Piotr, first thanks for sharing.
Unfortunately for me this solution does not work, I’m getting the result: “More than 1 developer package named ‘TestDeployPack’ exists in this organization. Please rename one of packages so that it has a unique name.”
Tried creating the zip with a folder and without it, also tried changing the API to 49 like your example, nothing seems to work on my end.
Typo at closing tag for description in package.xml