Newer Version Available
Retrieve Unpackaged Source by Creating a Temporary Unmanaged Package
Don’t already have your source defined in a package.xml file? No
worries. To simplify the source retrieval process, you can use the Unmanaged Package UI to
define what you want to retrieve. Create an unmanaged package in your sandbox, and add your
app’s source to it.
-
Open the sandbox org that contains your metadata.
1sfdx force:org:open -u <username> --path one/one.appYou can use the sandbox username or an alias. - Open All Setup.
- Open Package Manager.
- Create a package with the name of your application.
- Add the metadata source to the package.
- In your Salesforce DX project, create a folder for the MDAPI retrieve, for example, mdapipkg.
-
Retrieve the metadata.
1sfdx force:mdapi:retrieve -s -r ./mdapipkg -u <username> -p <package name>The -s parameter indicates that you’re retrieving a single package. The package name is the name you used in step 4. -
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 your source, you can delete or refresh your sandbox or delete the package definition in the sandbox org. Now that you have the source, you don’t need the resources.
Next, convert the metadata source.