Convert SFDX Source to MDAPI Source

In this exercise, you will…

  • Use force:source:convert to convert SFDX source to MDAPI source
  • Make sure that package.xml has the correct fullName key defined

Use force:source:convert to convert SFDX source to MDAPI source

Now we’re converting our source back to the MDAPI format from the SFDX format.

Execute this command:

sfdx force:source:convert \
    -d mdapi-source/updated-package \
    -n "My Managed Package"
Salesforce DX Command / Flags Description
force:source:convert Converts source-formatted files into metadata that you can deploy using Metadata API.
-d (--outputdir) The output directory to store the Metadata API–formatted metadata files in.
-n (--packagename) The name of the package to associate with the metadata-formatted files.

After executing the above, your terminal should look something like this:

Make sure that package.xml has the correct fullName key defined

  1. Open the mdapi-source/updated-package folder in the VS Code Explorer.
  2. Click on the package.xml file.
  3. Observe the value you specified for the -n (--packagename) flag
  4. See how it gets placed in the package.xml file in the fullName key.

Updated: