Working with the developer @Hao Liu I'm posting this response because his english is not as good. But I want to thank him for his commitment to this great Sublime Text plugin and contribution to the Salesforce developers community
1. Set up SublimeApex
To start, once you install SublimeApex from Package Control and restart Sublime Text, you first need to setup your user settings (this will establish your authentication to for any environment you wish to connect to):
Project examples, you can setup as many as you want (Production, Sandbox, Developer environment, etc)
"projects":
{
"Production":
{
"allowed_packages":
[
],
"default": false,
"login_url": "https://login.salesforce.com",
"password": "********",
"production": "https://login.salesforce.com",
"sandbox": "https://test.salesforce.com",
"security_token": "Ucv1d984sdfbbg64py",
"username": "[email protected]"
},
"Sandbox": <<---- These cannot be the same, i.e. "Project-Name"
{
"allowed_packages":
[
],
"default": true,
"login_url": "https://test.salesforce.com",
"password": "********",
"security_token": "h94jhjhyn98bvtre7wg4ewtrh",
"username": "[email protected]"
}
},
"workspace": "C:/projects/salesforce"
NOTE: Projects are essentially like your environments as you'll see played out here
If you switch to any of these projects then a folder with a .config
folder will appear in your workspace for authentication purposes
NOTE: you can create as many or as little projects from these connections as you would like (each with their own timestamp by default).
2. Fetch your project's or environment's package
Next, simply add a new project which will fetch the environment from your active project (in this case, Sandbox)
This will build a default package.xml
that will package your active environment into a .zip
and then unpack the contents into the projects workspace or default workspace if there is not one declared for that project in your settings. In Sublime you should see the new folder like this.
3. Create a custom package
For this example we want to include things like Custom Objects so that they can be used for deployment to other environments as well. So I need to make a separate custom package for this environment, do so by either of the following:
- right-clicking on the sandbox folder,
SublimeApex > Create Package.xml
--------------- OR ---------------
- copy the current
package.xml
and move to the root of your project directory (preferred)
TIP: Where ever your custom package.xml
file is when you retrieve it is where the fetched package will be
Setup your custom package.xml
Since, for this example, we want Custom Objects we need to include the following:
<types>
<members>*</members>
<name>CustomObject</name>
</types>
Then save right-click anywhere in the file (make sure the correct environment/project is still active), and select SublimeApex > Retrieve Package.xml
Once your package has been fetched you should see a new folder project-name-timestamp], for this example I got
Sandbox-201412171532`
4. Deploy Contents
While in a file or by clicking any folder contents within the sidebar, select SublimeApex > Deploy to Server
BONUS: If you curious about what metadata you can fetch here's the documentation page