Newer Version Available

This content describes an older version of this product. View Latest

Convert the Metadata Source to Source Format

After you retrieve the source from your org, you can complete the configuration of your project and convert the metadata source to source format.

The convert command ignores all files that start with a “dot,” such as .DS_Store. To exclude more files from the convert process, add a .forceignore file.

  1. Convert metadata format to source format. Let’s say you created a directory called mdapi_project when you retrieved the metadata.
    1sfdx force:mdapi:convert --rootdir mdapi_project --outputdir tmp_convert

    The --rootdir parameter is the name of the directory that contains the metadata source.

    If you don’t indicate an output directory with the --outputdir parameter, the converted source is stored in the default package directory indicated in the sfdx-project.json file. If the output directory is located outside of the project, you can indicate its location using an absolute path.

  2. To indicate which package directory is the default, update the sfdx-project.json file.
If there are two or more files with the same file name yet they contain different contents, the output directory contains duplicate files. Duplicate files can occur if you convert the same set of metadata more than once. The mdapi:convert process identifies these files with a .dup file extension. The source:push and source:pull commands ignore duplicate files, so you’ll want to resolve them. You have these options:
  • Choose which file to keep, then delete the duplicate.
  • Merge the files, then delete the other.

Next steps:

  • Authorize the Dev Hub org and set it as the default
  • Configure the Salesforce DX project
  • Create a scratch org