In Salesforce, deployment is an important part of development. Developers often need to move metadata like Apex classes, triggers, flows, and objects from one org to another.
One of the most commonly used methods for this is an Unmanaged Package. In many real-time projects, developers also need to create a ZIP file of the package for deployment using tools such as the Metadata API or the Salesforce CLI.
In this article, we will understand:
- What is an unmanaged package
- Why do we create a ZIP file
- Step-by-step process
- Real-time use cases
- Common mistakes
To create an unmanaged package in Salesforce, we use the package manager that adds components and generates an installation URL after uploading the package.
This is a very easy way to create and deploy a package in Salesforce, allowing others to install it directly without using VS Code or Workbench.
The issue arises when the package created in the source org is deleted. Consequently, a user from another org attempting to install the package will be unable to access it, as it has been deleted from the source org.
To use the package in the target org, even if it is deleted from the source org, we need to download it in a zip file. Then, even if the source org deletes the data, other users can still install the package using the downloaded zip file.
What is an Unmanaged Package in Salesforce?
An Unmanaged Package is a collection of Salesforce components that can be moved between orgs.
These components can include:
- Apex Classes
- Triggers
- Custom Objects
- Fields
- Flows
- Validation Rules
Important Point:
Unmanaged packages are mainly used for:
- Development
- Learning
- One-time deployment
Managed vs Unmanaged Package in Salesforce
| Feature | Managed Package | Unmanaged Package |
|---|---|---|
| Editable after install | No | Yes |
| Used for AppExchange | Yes | No |
| Version control | Yes | No |
| Best for | ISVs | Developers |
Why Do We Need a ZIP File in Salesforce?
In many cases, you cannot deploy directly from the UI.
You need a ZIP file when:
- Using Metadata API
- Using Salesforce CLI (SFDX)
- CI/CD deployment
- Moving code between environments
ZIP file contains:
- metadata files
- package.xml
package.xml File to Retrieve Components From Salesforce Org
Now we will understand, step by step, how to create an unmanaged package using Workbench, download it, and install it as a zip file in Salesforce.
After retrieving the metadata via VS Code CLI or Workbench and zipping it, we can delete the package from our system. Others can then install it from the zip file using Workbench or VS Code CLI in their organization.
First, we need to understand that the Salesforce Workbench does not ‘create packages’ in the same way as we do using the UI package manager feature.
First, we need to create a package.xml file and add metadata to retrieve. Below, I will show the XML file to understand how the metadata is retrieved from Salesforce.
You can create this file in VS Code or Notepad and add the content that you want to retrieve from Salesforce.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexTrigger</name>
</types>
<types>
<members>*</members>
<name>CustomObject</name>
</types>
<version>60.0</version>
</Package>Next, save this file as package.xml, as we will use it to download data from Salesforce. This file will retrieve all Apex classes, triggers, and custom objects.
How to Add Objects, Fields, Flows, and Other Components in the package.xml File
Below, I will explain how to add standard and custom objects, fields, and other components to the package.xml file if you need specific data, so that we can retrieve that metadata from Salesforce.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<!-- Include Custom Objects and Fields-->
<types>
<members>Custom_Object_1__c</members>
<name>CustomObject</name>
</types>
<!-- Include Custom Fields on Standard /Custom Objects -->
<types>
<members>Account.Custom_Field_1__c</members>
<members>Employee__c.Employee_Name__c</members>
<name>CustomField</name>
</types>
<!-- Include the Flow -->
<types>
<members>Your_Flow_API_Name</members>
<name>Flow</name>
</types>
<!-- Include Email Templates if needed -->
<types>
<members>FolderName/TemplateName</members>
<name>EmailTemplate</name>
</types>
<version>60.0</version>
</Package>
In this way, you can add the components as metadata to retrieve from the Salesforce org.
Create and Export Unmanaged Package Zip File in Salesforce
For example, I want to create a package for the flow I created to add CC recipients dynamically in Salesforce.
This flow is dependent on the custom object named CC Recipients__c. In this object, I stored the email addresses in the email fields.
If the Flow references Custom Objects, Email Templates, or Custom Fields, they must also be included in package.xml; otherwise, deployment may fail.
Now, let’s create the package.xml file for our flow and add the other components it depends on.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Add_CC_List</members>
<name>Flow</name>
</types>
<types>
<members>CC_Email_List__c</members>
<members>Apply_Leave__c</members>
<name>CustomObject</name>
</types>
<version>60.0</version>
</Package>Now, open the Workbench. Then fill in the details:
- Environment: Production or Sandbox.
- API Version: 60.0 (or latest).
- Agree to terms.
- Click Login with Salesforce.

When you click ‘Login with Salesforce,’ you must use your Salesforce Developer org credentials.
After that, you will see the Workbench UI. You need to click the Migration dropdown in the top menu and select the Retrieve option.

After that, under Unpackaged Manifest, click Choose File. Here, select the package.xml file we created, which contains the component we want to retrieve from Salesforce.
Leave other options as default and click the Next button to proceed.

Next, click the Retrieve button.

Now this step will take some time, so wait until the process completes. After completing the process, you will see the Status with the ID of your package.
Then, click the Download ZIP File, and it will be saved to your local system.

You can see the ZIP file you downloaded, which contains the component you wanted to deploy to a different Salesforce org.
You can share this file with other users who have a Salesforce org account.

In this way, we can create the downloadable package.xml.zip file that contains the component you want to deploy to the Salesforce org.
Deploy an Unmanaged Package To Other Salesforce Org Using Workbench
In the steps above, we created a package that contains the flow and the other components on which it depends.
We will now deploy this package to other Salesforce orgs. Before deploying to another org, let me show you the components we added to the package above that are not available in this org.
Below, you can see there are no components available in this org. Now we will install the package that we created.

Now open the workbench in the browser and again follow the starting steps to log in to Salesforce. Here, you need to log in with the credentials you want to use for deploying the package.
After that, you will see the Workbench UI. You need to click the Migration dropdown in the top menu and select the Deploy option.

Next, click Choose File, then select the ZIP file you downloaded that contains all the components you want to deploy to this Salesforce org.
Then check the Rollback on Error checkbox. If you don’t add the deployment, it will fail. If you have checked Rollback On Error, other components won’t be deployed either, so you’ll need to redeploy the entire package.
Click the Next button to proceed.

We are now ready to deploy the package. Click the Deploy button.

When creating the package.xml file, if you add a dependent component (such as a child object), you must also add the parent object. Similarly, if you add a flow, you need to include the related object it uses.
Below you can see the Status is Succeeded. That means our package has been successfully deployed in this org.

To check the installed components, you can check in the Salesforce org.

In this way, we can deploy the unmanaged package by installing a ZIP file in Salesforce.
Conclusion
Creating a ZIP file from an unmanaged package is an important skill for Salesforce developers. It helps in deploying metadata efficiently using modern tools like Salesforce CLI and Metadata API.
I hope you have an idea of how to create and export an unmanaged package as a ZIP file in Salesforce.
In this, I have explained how to create a package.xml file to add the components we want to deploy across different orgs. Then we saw how to deploy a package we downloaded as a ZIP file.
You may like to read:
- Create and Deploy an Unmanaged Package in Salesforce
- Salesforce Managed and Unmanaged Packages
- Create Downloadable Salesforce Packages with VS Code & CLI

Shubham is a Certified Salesforce Developer with technical skills for Building applications using custom objects, approval processes, validation rule salesforce flows, and UI customization. He is proficient in writing Apex classes, triggers, controllers, Apex Batches, and bulk load APIs. I am also familiar with Visualforce Pages and Lighting Web Components. Read more | LinkedIn Profile