2

Using the Salesforce IDE for Sublime Text 3 (SublimeApex) to interact with Salesforce data I've come across a couple questions I'm hoping to find help with.

Can I migrate custom objects and/or fields from my sandbox into my production environment? Is it something I have to manually setup in the package.xml or is it something even possible with this tool?

Most of the help I can find about migrating object data mentions MavensMate or the Force.com Migration tool but before I look into those options I really want to understand the process and determine if the tool I'm currently using is capable for performing such a task.

Thanks

  • It doesn't look like that supports moving objects. I use MavensMate to do this all the time. They have a nice bootstrapped interface where you can simply choose the objects and such from one org, build the package.xml automatically, and then do your deploy to any other org. Very very easy to use. – cricketlang Dec 16 '14 at 3:09
1

@Xtremefaith, sorry, I can't add comment below your post.

I like scriptly deployment and always use ant to deploy, generally, I will use eclipse to build my package.xml and deploy it by SublimeApex, however, building the package.xml by UI is very slowly, sometimes, I just want to deploy lots of components and I can directly write the package.xml without UI, therefore, in order to improve the efficiency on writing my package.xml, I made lots of improvement work on how to build package.xml more quickly.

If you are familiar with ant deployment, I think below demo is very helpful for you.

I have posted demo to show how to deploy custom fields or something else by SublimeApex, this demo file is more than 19.5M, when you are opening it, please be patiently.

  • Question, so are you just making an unmanaged package and deploying it? And if so is that something that can just be uninstalled by an admin in Salesforce. I'm not familiar with creating packages yet and not sure if this is a saleforce package or just a coincidence because the file is called package.xml – Xtremefaith Dec 17 '14 at 17:40
  • I've been testing MM to see how it works and basically it comes with a GUI but essentially does the same thing, it builds a package.xml although neither one seem to fetch all CustomObjects when using the * wildcard, you have to manually add each <member> which kinda stinks :( – Xtremefaith Dec 17 '14 at 18:31
1

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):

Setup User Settings

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@company.com"
    },
    "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@company.com.dev"
    }
},
"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

enter image description here enter image description here

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)

enter image description here

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.

enter image description here

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:

  1. right-clicking on the sandbox folder, SublimeApex > Create Package.xml enter image description here

--------------- OR ---------------

  1. 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

enter image description here

Once your package has been fetched you should see a new folder project-name-timestamp], for this example I gotSandbox-201412171532`

Custom Package with timestamp

4. Deploy Contents

While in a file or by clicking any folder contents within the sidebar, select SublimeApex > Deploy to Server

enter image description here

BONUS: If you curious about what metadata you can fetch here's the documentation page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.