5

I am really excited about Salesforce DX and I have playing with it for a while. However, I'm still looking for a way to retrieve all metadata from our client's sandbox in order to convert it to the Salesforce DX new file system structure.

I know that I can create a unmanaged package and retrieve it easily with DX CLI. But my client's org is pretty big with huge amount of metadata, so creating an unmanaged package is going to take me a while, plus I have to keep updating it each time metadata changes. Not a good solution for the long run.

Is there an easy way of getting absolutely all metadata from a sandbox? It's like getting a copy of the sandbox using metadata API or any other tool. I have trying the new command of DX: sfdx force:mdapi:retrieve, but I was not successful for now.

Thanks

4 Answers 4

10

This is what I would do:

  1. Create a project in Force IDE or Mavensmate connecting to your sandbox and select all the metadata components and retrieve metadata. Trick here is that Force IDE and Mavensmate also creates package.xml

  2. Now use the package.xml created in above step and use the below command as suggested in this answer

    sfdx force:mdapi:retrieve --retrievetargetdir force-app -k package.xml

6
  • Actually I have thought about this. But the question is, are we sure that Force IDE or Mavensmate are able to retrieve everything? Commented Oct 27, 2017 at 23:23
  • 1
    @RiadhMankai Yes, it does depending on the component types you choose while creating project in Mavensmate and Force IDE.
    – javanoob
    Commented Oct 27, 2017 at 23:24
  • 1
    @RiadhMankai the IDE can retrieve everything that can be deployed via DX. Keep in mind that not all metadata can be deployed, but there are also additional settings you can deploy during scratch org creation. Be sure to check the documentation.
    – sfdcfox
    Commented Oct 27, 2017 at 23:48
  • 3
    I'm good with these options thanks guys. I also found a web called the Salesforce Toolkit that actually does a good job on getting a package.xml with full metadata of an org. Commented Oct 28, 2017 at 13:11
  • 2
    How do you build your package.xml file? Both Mavensmate and Force IDE are not being updated. Force IDE uses a max API version of 38 (so I cannot synchronize lightning components)
    – Jon Wolski
    Commented Jun 14, 2018 at 16:07
2

The SFDX CLI now has the sf project generate manifest command, previously sfdx force source manifest create.

With that you can generate a complete package.xml to represent the orgs metadata. From there it becomes a metadata retrieve.

Roughly:

  1. sfdx force source manifest create --fromorg [your org alias] --manifestname=allMetadata --outputdir manifest
  2. sfdx force:mdapi:retrieve --retrievetargetdir force-app -k package.xml

There is also a video walk through by Alba Rivas show this in Generating Manifests with the Salesforce CLI and VS Code | Developer Quick Takes

1

I create my package.xml with Salesforce Toolkit - https://packagebuilder.herokuapp.com/ I manually edited the package.xml and used it with salesforce dx. Caution - the toolkit will connect to your org. The author has made the source code available so you can download, scan and run locally.

IntelliJ with JetForcer or IlluminatedCloud are great options as well.

0

This one works for me very well for me

https://www.npmjs.com/package/sfdx-ext

You must log in to answer this question.

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