Newer Version Available
Retrieve Unpackaged Source Defined in a package.xml File
If you already have a package.xml file, you can retrieve it, unzip
it in your local project, and convert the source to Salesforce DX format. You can do all these
tasks from the CLI. The package.xml file defines the source you want to
retrieve.
If you already have the source retrieved from the Metadata API, you can skip to converting the metadata API source.
- In the project, create a folder to store what’s retrieved from your org, for example, mdapipkg.
-
Retrieve the metadata.
1sfdx force:mdapi:retrieve -r ./mdapipkg -u <username> -k ./package.xmlThe username can be the scratch org username or an alias. The -k parameter indicates the path to the package.xml file, which is the unpackaged manifest of components to retrieve. -
Check the status of the retrieve.
When you run force:mdapi:retrieve, the job ID, target username, and retrieve directory are stored, so you don’t have to specify these required parameters to check the status. These stored values are overwritten when you run the force:mdapi:retrieve again.
1sfdx force:mdapi:retrieve:reportIf you want to check the status of a different retrieve operation, specify the retrieve directory and job ID on the command line, which overrides any stored values. - Unzip the zip file.
- (Optional) Delete the zip file.
After you retrieve the source and unzip it, you no longer need the zip file, so you can delete it.
After you finish, convert the metadata source.