0

I'm trying to create a small custom tool to quickly deploy between a couple of orgs with NodeJS and this package.

The issue I have is that I don't really know how to create/setup the package.xml and the metadata around it. The specific questions regarding the setup would be:

  1. When deploying a set of custom objects and fields, for example, how should I set/create the package as well as the package.xml? I have seen I can point either a directory or a .zip file, but I don't know how these should look like.

  2. When creating the package.xml, is there a standard way to do it or do I have to construct the file line by line myself?

  • Have you seen the SFDX CLI? It's built with node.js and already has a number of commands for moving metadata between orgs. – Daniel Ballinger Oct 10 '17 at 22:11
1

You can create the appropriate files using virtually any modern IDE. Historically, I've done this in the Force.com IDE, so that I can manually select the files I want. Once you do this, you'll get a "src\package.xml" file that will contain all the selected elements. You could also do this with most other IDEs that support Salesforce, such as Cloud 9, MavensMate, Atom, and so on. Virtually every IDE at this point uses either the metadata API or SFDX, and both formats are very similar.

If you prefer to write scripts, you could also do so with SFDX, and it includes commands to retrieve metadata using a Package, which is arguably the easiest way to make sure you don't miss any essential files, and can easily deploy your config between different orgs. Conceptually, you could even do this with the Workbench: just build the package, specify the package name, and you can do a retrieve without even installing any software or downloading anything. The Workbench can also deploy these files to any org you have admin access to just by uploading the file.

| improve this answer | |
1

I suggest downloading the force.com migration tool and using the package.xml in the sample project as a starting point. I usually modify this file instead of writing a package from scratch:

https://developer.salesforce.com/page/Force.com_Migration_Tool

The metadata needs to stored in a specific directory structure. To see what that structure is for the specific metadata types you're working with, pull the metadata with the migration tool - it will build the directory structure automatically.

| improve this answer | |

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.