0

How do you begin to pull all the metadata of Salesforce Production Org so that everything could be tracked in a Version Control System.How do I create that complete package.xml which will pull completely everything. Later I could add the certain config metadata to .forceignore so that I don't push them through my CI/CD pipeline.Also please suggest through your experience, what should not be ideally pushed through a pipeline and trade-off is better to perform them through the UI (For now i have considered listViews,reports/dashboards,certificates,profiles). I'm open to hearing best practices as well.

3
  • Use sfdx - you don't need a package.xml for that.
    – Phil W
    Feb 8, 2020 at 9:39
  • Thanks for your prompt response @Phil W. I had run sfdx force:source:retrieve but since the initial project that was created was a manifest project,the command now expects the path to manfest/package.xml. Also our deployment pipeline has a -x parameter to deploy only the metadata included in package.xml. Another approach would be to create a new test project without manifest and run the retrieve command and then copy the contents of new project's force-app/ to my original project in the force-app/ directory. Will that suffice?
    – Chetan
    Feb 8, 2020 at 9:51
  • Oh I think any which way they will need a path to package.xml.
    – Chetan
    Feb 8, 2020 at 10:07

2 Answers 2

3

The idea of "all" the metadata is tough to define. The Metadata API does not capture some settings. Check the coverage report. Secondly, there are serious limits to Metadata Retrieve both in number of objects and overall size. In general Metadata for large Orgs must be brought down in sections and recombined, and this is really challenging for entangled objects like Profiles and Translations. Discovering which Metadata Assets are available for Retrieve is also difficult. Many available assets are not returned by Metadata List.

If you have a CI/CD Pipeline, then I would focus on the assets that developers need to integrate and build. Apex classes, triggers and pages, lightning pages, custom objects, custom tabs, etc. Use repos for the intended purpose: code merge. We have seen production Orgs with over 1 million assets that take up huge amounts of space. Storing all that XML in a repo is difficult and pointless. I like your list: don't worry about Profiles and the Folder Based objects like dashboards, reports, documents, and email templates. Another strategy is to focus on Packages.

2

If you use Intellij with Illuminated Cloud plugin you can 'select all' and it will create the package.xml for you. You can then use that package.xml in a different editor, such as Visual Studio Code if you so desire.

Once you have set up your connection (there's plenty of information online on how to do that), right click on src - Illuminated Cloud - Retrieve Metadata

enter image description here

Then select 'Custom' as Content and you can check the box at the top to 'select all'

enter image description here

Once the retrieve completes you will have a package.xml in your src directory with all the metadata types that it is possible to retrieve with the tool.

1
  • Thanks Mike.I realized there is also a new Org browser thing in VS code which shows all the metadata of the org .May be i can include them in the package.xml.
    – Chetan
    Feb 8, 2020 at 17:10

Not the answer you're looking for? Browse other questions tagged .