Newer Version Available
Retrieve Source from an Existing Managed Package
If you’re a partner or ISV who already has a managed package in a packaging org, you’re
in the right place. You can retrieve that package, unzip it to your local project, and then
convert it to source format, all from the CLI.
Before you begin, create a Salesforce DX project.
- In the project, create a folder to store what’s retrieved from your org, for example, mdapipkg.
-
Retrieve the metadata.
1sfdx force:mdapi:retrieve -s -r ./mdapipkg -u <username> -p <package name>The username can be a username or alias for the target org (such as a packaging org) from which you’re pulling metadata. The -s parameter indicates that you’re retrieving a single package. If your package name contains a space, enclose the name in single quotes.1-p 'Test Package' -
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 finish, convert the metadata to source format.